… | |
… | |
125 | # quarter the texture size |
125 | # quarter the texture size |
126 | $tw >>= 1; |
126 | $tw >>= 1; |
127 | $th >>= 1; |
127 | $th >>= 1; |
128 | } |
128 | } |
129 | |
129 | |
130 | my $need_render = $self->{render_cb} || $tw < $self->{w} || $th < $self->{h}; |
130 | my $render = $self->{render_cb} || $tw < $self->{w} || $th < $self->{h}; |
131 | |
131 | |
132 | if ($need_render) { |
132 | if ($render) { |
133 | glViewport 0, 0, $tw, $th; |
133 | glViewport 0, 0, $tw, $th; |
134 | glMatrixMode GL_PROJECTION; |
134 | glMatrixMode GL_PROJECTION; |
135 | glLoadIdentity; |
135 | glLoadIdentity; |
136 | glOrtho 0, $self->{w}, 0, $self->{h}, -10000, 10000; |
136 | glOrtho 0, $self->{w}, 0, $self->{h}, -10000, 10000; |
137 | glMatrixMode GL_MODELVIEW; |
137 | glMatrixMode GL_MODELVIEW; |
… | |
… | |
172 | glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR; |
172 | glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR; |
173 | } |
173 | } |
174 | |
174 | |
175 | glGetError; |
175 | glGetError; |
176 | |
176 | |
177 | if ($need_render) { |
177 | if ($render) { |
178 | glCopyTexImage2D GL_TEXTURE_2D, 0, |
178 | glCopyTexImage2D GL_TEXTURE_2D, 0, |
179 | $self->{internalformat}, |
179 | $self->{internalformat}, |
180 | 0, 0, |
180 | 0, 0, |
181 | $tw, $th, |
181 | $tw, $th, |
182 | 0; |
182 | 0; |