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.29 by root, Wed Apr 12 20:42:52 2006 UTC vs.
Revision 1.31 by root, Fri Apr 14 14:55:27 2006 UTC

31sub gl_init { 31sub gl_init {
32 $GL_VERSION = gl_version * 1; 32 $GL_VERSION = gl_version * 1;
33 %GL_EXT = map +($_ => 1), split /\s+/, gl_extensions; 33 %GL_EXT = map +($_ => 1), split /\s+/, gl_extensions;
34 34
35 $GL_NPOT = $GL_EXT{GL_ARB_texture_non_power_of_two} || $GL_VERSION >= 2; 35 $GL_NPOT = $GL_EXT{GL_ARB_texture_non_power_of_two} || $GL_VERSION >= 2;
36
37 glClearColor 0.45, 0.45, 0.45, 1;
38 36
39 glEnable GL_TEXTURE_2D; 37 glEnable GL_TEXTURE_2D;
40 glEnable GL_COLOR_MATERIAL; 38 glEnable GL_COLOR_MATERIAL;
41 glShadeModel GL_FLAT; 39 glShadeModel GL_FLAT;
42 glDisable GL_DEPTH_TEST; 40 glDisable GL_DEPTH_TEST;
181 if (exists $self->{data}) { 179 if (exists $self->{data}) {
182 $data = $self->{data}; 180 $data = $self->{data};
183 181
184 } elsif (exists $self->{render_cb}) { 182 } elsif (exists $self->{render_cb}) {
185 glViewport 0, 0, $self->{w}, $self->{h}; 183 glViewport 0, 0, $self->{w}, $self->{h};
186 glOrtho 0, $self->{w}, 0, $self->{h}, -10000, 10000;
187 glMatrixMode GL_PROJECTION; 184 glMatrixMode GL_PROJECTION;
188 glLoadIdentity; 185 glLoadIdentity;
186 glOrtho 0, $self->{w}, 0, $self->{h}, -10000, 10000;
189 glMatrixMode GL_MODELVIEW; 187 glMatrixMode GL_MODELVIEW;
190 glLoadIdentity; 188 glLoadIdentity;
191 glClear GL_COLOR_BUFFER_BIT;
192 $self->{render_cb}->($self, $self->{w}, $self->{h}); 189 $self->{render_cb}->($self, $self->{w}, $self->{h});
193 190
194 } else { 191 } else {
195 ($self->{w}, $self->{h}, $data, $self->{internalformat}, $self->{format}, $self->{type}) 192 ($self->{w}, $self->{h}, $data, $self->{internalformat}, $self->{format}, $self->{type})
196 = CFClient::load_image_inline $self->{image}; 193 = CFClient::load_image_inline $self->{image};
241 glCopyTexImage2D GL_TEXTURE_2D, 0, 238 glCopyTexImage2D GL_TEXTURE_2D, 0,
242 $self->{internalformat}, 239 $self->{internalformat},
243 0, 0, 240 0, 0,
244 $tw, $th, 241 $tw, $th,
245 0; 242 0;
246 glGetError and die; 243 glGetError and die "glCopyTexImage2D $tw,$th";
247 } 244 }
248} 245}
249 246
250sub DESTROY { 247sub DESTROY {
251 my ($self) = @_; 248 my ($self) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines