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.9 by elmex, Sat Apr 8 16:34:46 2006 UTC vs.
Revision 1.12 by root, Sat Apr 8 18:48:34 2006 UTC

125} 125}
126 126
127sub new_from_opengl { 127sub new_from_opengl {
128 my ($class, $w, $h, $cb) = @_; 128 my ($class, $w, $h, $cb) = @_;
129 129
130 $class->_new (width => $w, height => $h, render => $cb) 130 $class->_new (width => $w, height => $h, rendercb => $cb)
131} 131}
132 132
133sub upload { 133sub upload {
134 my ($self) = @_; 134 my ($self) = @_;
135 135
139 139
140 if (exists $self->{data}) { 140 if (exists $self->{data}) {
141 $data = $self->{data}; 141 $data = $self->{data};
142 } elsif (exists $self->{rendercb}) { 142 } elsif (exists $self->{rendercb}) {
143 glViewport 0, 0, $self->{width}, $self->{height}; 143 glViewport 0, 0, $self->{width}, $self->{height};
144 glMatrixMode GL_PROJECTION;
145 glLoadIdentity;
146 glOrtho 0, $self->{width}, $self->{height}, 0, -100, 100;
147 glMatrixMode GL_MODELVIEW;
148 glPushmatrix;
149 glLoadIdentity;
144 glClear GL_COLOR_BUFFER_BIT; 150 glClear GL_COLOR_BUFFER_BIT;
145 151
146 $self->{rendercb}->($self, $self->{width}, $self->{height}); 152 $self->{rendercb}->($self, $self->{width}, $self->{height});
147 } else { 153 } else {
148 my $pb = new Gtk2::Gdk::PixbufLoader; 154 my $pb = new Gtk2::Gdk::PixbufLoader;
174 0, 180 0,
175 GL_RGBA, 181 GL_RGBA,
176 GL_UNSIGNED_BYTE, 182 GL_UNSIGNED_BYTE,
177 $data; 183 $data;
178 } else { 184 } else {
185 warn "I{DTEDRAW TEX: $self->{width} $self->{height} \n";
186 warn "ERR: ". (glGetError). "\n";
187 my ($bd, $br) = (glGet (GL_DRAW_BUFFER), glGet (GL_READ_BUFFER));
188 warn "BUF:[$bd $br]\n";
189
179 glCopyTexImage2D GL_TEXTURE_2D, 0, 190 glCopyTexImage2D GL_TEXTURE_2D, 0,
180 GL_RGBA8, 191 GL_RGBA8,
181 0, 0, 192 0, 0,
182 $self->{width}, $self->{height}, 193 $self->{width}, $self->{height},
183 0; 194 0;
195 glPopmatrix;
196 warn "ERR: ". (glGetError). "\n";
197 sleep 1;
184 } 198 }
185} 199}
186 200
187sub DESTROY { 201sub DESTROY {
188 my ($self) = @_; 202 my ($self) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines