ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.7 by root, Fri Apr 7 20:55:32 2006 UTC vs.
Revision 1.8 by root, Sat Apr 8 13:36:25 2006 UTC

121 (new SDL::Color -r => 255, -g => 255, -b => 255); 121 (new SDL::Color -r => 255, -g => 255, -b => 255);
122 122
123 $class->new_from_surface (bless \$surface, SDL::Surface::) 123 $class->new_from_surface (bless \$surface, SDL::Surface::)
124} 124}
125 125
126sub new_from_opengl {
127 my ($class, $w, $h, $cb) = @_;
128
129 $class->_new (width => $w, height => $h, render => $cb)
130}
131
126sub upload { 132sub upload {
127 my ($self) = @_; 133 my ($self) = @_;
128 134
129 return unless $SDL::App::USING_OPENGL; 135 return unless $SDL::App::USING_OPENGL;
130 136
131 my $data; 137 my $data;
132 138
133 if (exists $self->{data}) { 139 if (exists $self->{data}) {
134 $data = $self->{data}; 140 $data = $self->{data};
141 } elsif (exists $self->{rendercb}) {
142 glViewport 0, 0, $self->{width}, $self->{height};
143 glClear GL_COLOR_BUFFER_BIT;
144
145 $self->{rendercb}->($self, $self->{width}, $self->{height});
135 } else { 146 } else {
136 my $pb = new Gtk2::Gdk::PixbufLoader; 147 my $pb = new Gtk2::Gdk::PixbufLoader;
137 $pb->write ($self->{image}); 148 $pb->write ($self->{image});
138 $pb->close; 149 $pb->close;
139 150
153 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR; 164 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR;
154 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR;#_MIPMAP_LINEAR; 165 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR;#_MIPMAP_LINEAR;
155 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP; 166 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP;
156 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP; 167 glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP;
157 168
169 if (defined $data) {
158 glTexImage2D GL_TEXTURE_2D, 0, 170 glTexImage2D GL_TEXTURE_2D, 0,
159 GL_RGBA8, 171 GL_RGBA8,
160 $self->{width}, $self->{height}, 172 $self->{width}, $self->{height},
161 0, 173 0,
162 GL_RGBA, 174 GL_RGBA,
163 GL_UNSIGNED_BYTE, 175 GL_UNSIGNED_BYTE,
164 $data; 176 $data;
177 } else {
178 glCopyTexImage2D GL_TEXTURE_2D, 0,
179 GL_RGBA8,
180 0, 0,
181 $self->{width}, $self->{height},
182 0;
183 }
165} 184}
166 185
167sub DESTROY { 186sub DESTROY {
168 my ($self) = @_; 187 my ($self) = @_;
169 188

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines