--- deliantra/Deliantra-Client/DC/Texture.pm 2007/07/19 21:02:02 1.18 +++ deliantra/Deliantra-Client/DC/Texture.pm 2007/07/19 23:29:17 1.21 @@ -142,6 +142,7 @@ # decide the amount of space used in the texture my ($rw, $rh); + my $render; if ($self->{render_cb}) { # use only part of the texture @@ -149,10 +150,12 @@ #$rh >>= 1 while $rh > $th; $rw = min $dw, $tw; $rh = min $dh, $th; + ++$render; } else { if ($self->{wrap} || $tw < $dw || $th < $dh) { # scale to the full texture size ($rw, $rh) = ($tw, $th); + ++$render; } else { # pad pad $data, $dw, $dh, $tw, $th; @@ -161,12 +164,10 @@ } } - # rendering means we need to scale in some way - my $render = $self->{render_cb} || $rw != $dw || $th != $dh; - if ($render) { glViewport 0, 0, $tw, $th; - glClear 0, 0, 0, 0; + #glScissor 0, 0, $tw, $th; + #glEnable GL_SCISSOR_TEST; glMatrixMode GL_PROJECTION; glLoadIdentity; glOrtho 0, $tw, 0, $th, -10000, 10000; @@ -177,6 +178,8 @@ glScale $rw / $dw, $rh / $dh; $self->{render_cb}->($self, $rw, $rh); } else { + glClearColor 0, 0, 0, 0; + glClear GL_COLOR_BUFFER_BIT; glPixelZoom $tw / $dw, $th / $dh; glDrawPixels $dw, $dh, $self->{format}, @@ -219,6 +222,8 @@ 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},