--- deliantra/Deliantra-Client/DC/Texture.pm 2007/07/19 23:29:17 1.21 +++ deliantra/Deliantra-Client/DC/Texture.pm 2007/07/24 00:11:18 1.22 @@ -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,10 @@ } if ($render) { - glViewport 0, 0, $tw, $th; + $ox = int .5 * ($::WIDTH - $tw); + $oy = int .5 * ($::HEIGHT - $th); + + glViewport $ox, $oy, $tw, $th; #glScissor 0, 0, $tw, $th; #glEnable GL_SCISSOR_TEST; glMatrixMode GL_PROJECTION; @@ -181,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}, @@ -217,7 +222,7 @@ 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",