… | |
… | |
179 | if (exists $self->{data}) { |
179 | if (exists $self->{data}) { |
180 | $data = $self->{data}; |
180 | $data = $self->{data}; |
181 | |
181 | |
182 | } elsif (exists $self->{render_cb}) { |
182 | } elsif (exists $self->{render_cb}) { |
183 | glViewport 0, 0, $self->{w}, $self->{h}; |
183 | glViewport 0, 0, $self->{w}, $self->{h}; |
184 | glOrtho 0, $self->{w}, 0, $self->{h}, -10000, 10000; |
|
|
185 | glMatrixMode GL_PROJECTION; |
184 | glMatrixMode GL_PROJECTION; |
186 | glLoadIdentity; |
185 | glLoadIdentity; |
|
|
186 | glOrtho 0, $self->{w}, 0, $self->{h}, -10000, 10000; |
187 | glMatrixMode GL_MODELVIEW; |
187 | glMatrixMode GL_MODELVIEW; |
188 | glLoadIdentity; |
188 | glLoadIdentity; |
189 | glClear GL_COLOR_BUFFER_BIT; |
|
|
190 | $self->{render_cb}->($self, $self->{w}, $self->{h}); |
189 | $self->{render_cb}->($self, $self->{w}, $self->{h}); |
191 | |
190 | |
192 | } else { |
191 | } else { |
193 | ($self->{w}, $self->{h}, $data, $self->{internalformat}, $self->{format}, $self->{type}) |
192 | ($self->{w}, $self->{h}, $data, $self->{internalformat}, $self->{format}, $self->{type}) |
194 | = CFClient::load_image_inline $self->{image}; |
193 | = CFClient::load_image_inline $self->{image}; |
… | |
… | |
239 | glCopyTexImage2D GL_TEXTURE_2D, 0, |
238 | glCopyTexImage2D GL_TEXTURE_2D, 0, |
240 | $self->{internalformat}, |
239 | $self->{internalformat}, |
241 | 0, 0, |
240 | 0, 0, |
242 | $tw, $th, |
241 | $tw, $th, |
243 | 0; |
242 | 0; |
244 | glGetError and die; |
243 | glGetError and die "glCopyTexImage2D $tw,$th"; |
245 | } |
244 | } |
246 | } |
245 | } |
247 | |
246 | |
248 | sub DESTROY { |
247 | sub DESTROY { |
249 | my ($self) = @_; |
248 | my ($self) = @_; |