--- deliantra/Deliantra-Client/DC/Texture.pm 2007/07/19 22:38:53 1.20 +++ deliantra/Deliantra-Client/DC/Texture.pm 2007/07/24 01:24:27 1.23 @@ -142,6 +142,7 @@ # decide the amount of space used in the texture my ($rw, $rh); + my ($ox, $oy); # area shift to lessen effetc of buggy opengl implementations (nvida, ati) my $render; if ($self->{render_cb}) { @@ -165,7 +166,12 @@ } if ($render) { - glViewport 0, 0, $tw, $th; + $ox = int .5 * ($::WIDTH - $rw); + $oy = int .5 * ($::HEIGHT - $rh); + + glViewport $ox, $oy, $tw, $th; + #glScissor 0, 0, $tw, $th; + #glEnable GL_SCISSOR_TEST; glMatrixMode GL_PROJECTION; glLoadIdentity; glOrtho 0, $tw, 0, $th, -10000, 10000; @@ -179,6 +185,7 @@ glClearColor 0, 0, 0, 0; glClear GL_COLOR_BUFFER_BIT; glPixelZoom $tw / $dw, $th / $dh; + glRasterPos 0, 0; glDrawPixels $dw, $dh, $self->{format}, $self->{type}, @@ -215,11 +222,13 @@ if ($render) { glCopyTexImage2D GL_TEXTURE_2D, 0, $self->{internalformat}, - 0, 0, + $ox, $oy, $tw, $th, 0; gl_check "copying to texture %dx%d if=%x", $tw, $th, $self->{internalformat}; + + #glDisable GL_SCISSOR_TEST; } else { glTexImage2D GL_TEXTURE_2D, 0, $self->{internalformat},