… | |
… | |
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; |
… | |
… | |
184 | glCopyTexImage2D GL_TEXTURE_2D, 0, |
190 | glCopyTexImage2D GL_TEXTURE_2D, 0, |
185 | GL_RGBA8, |
191 | GL_RGBA8, |
186 | 0, 0, |
192 | 0, 0, |
187 | $self->{width}, $self->{height}, |
193 | $self->{width}, $self->{height}, |
188 | 0; |
194 | 0; |
|
|
195 | glPopmatrix; |
189 | warn "ERR: ". (glGetError). "\n"; |
196 | warn "ERR: ". (glGetError). "\n"; |
|
|
197 | sleep 1; |
190 | } |
198 | } |
191 | } |
199 | } |
192 | |
200 | |
193 | sub DESTROY { |
201 | sub DESTROY { |
194 | my ($self) = @_; |
202 | my ($self) = @_; |