--- deliantra/Deliantra-Client/DC.pm 2006/04/08 13:36:25 1.8 +++ deliantra/Deliantra-Client/DC.pm 2006/04/08 22:23:57 1.13 @@ -55,6 +55,7 @@ or return; { + require Data::Dumper; local $Data::Dumper::Purity = 1; $::CFG->{VERSION} = $::VERSION; print CFG Data::Dumper->Dump ([$::CFG], [qw/CFG/]); @@ -118,7 +119,7 @@ utf8::encode $text; my $surface = SDL::TTFRenderUTF8Blended $ttf, $text, - (new SDL::Color -r => 255, -g => 255, -b => 255); + (new SDL::Color -r => 0, -g => 0, -b => 0); $class->new_from_surface (bless \$surface, SDL::Surface::) } @@ -126,7 +127,7 @@ sub new_from_opengl { my ($class, $w, $h, $cb) = @_; - $class->_new (width => $w, height => $h, render => $cb) + $class->_new (width => $w, height => $h, rendercb => $cb) } sub upload { @@ -140,6 +141,12 @@ $data = $self->{data}; } elsif (exists $self->{rendercb}) { glViewport 0, 0, $self->{width}, $self->{height}; + glMatrixMode GL_PROJECTION; + glLoadIdentity; + glOrtho 0, $self->{width}, 0, $self->{height}, -100, 100; + glMatrixMode GL_MODELVIEW; + glPushmatrix; + glLoadIdentity; glClear GL_COLOR_BUFFER_BIT; $self->{rendercb}->($self, $self->{width}, $self->{height}); @@ -161,8 +168,8 @@ glBindTexture GL_TEXTURE_2D, $self->{name}; - glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR; - glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR;#_MIPMAP_LINEAR; + glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST; + glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST;#_MIPMAP_LINEAR; glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP; glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP; @@ -175,11 +182,20 @@ GL_UNSIGNED_BYTE, $data; } else { + warn "I{DTEDRAW TEX: $self->{width} $self->{height} \n"; + warn "ERR: ". (glGetError). "\n"; + my ($bd, $br) = (glGet (GL_DRAW_BUFFER), glGet (GL_READ_BUFFER)); + warn "BUF:[$bd $br]\n"; + glCopyTexImage2D GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, $self->{width}, $self->{height}, 0; + glPopmatrix; + warn "ERR: ". (glGetError). "\n"; + SDL::GLSwapBuffers; + sleep 1; } }