… | |
… | |
124 | |
124 | |
125 | $class->new ( |
125 | $class->new ( |
126 | width => $w, |
126 | width => $w, |
127 | height => $h, |
127 | height => $h, |
128 | data => $data, |
128 | data => $data, |
129 | internalformat => GL_ALPHA8, |
129 | internalformat => GL_ALPHA4, |
130 | format => GL_ALPHA, |
130 | format => GL_ALPHA, |
131 | ) |
131 | ) |
132 | } |
132 | } |
133 | |
133 | |
134 | sub new_from_opengl { |
134 | sub new_from_opengl { |
… | |
… | |
178 | glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST; |
178 | glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST; |
179 | glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST;#_MIPMAP_LINEAR; |
179 | glTexParameter GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST;#_MIPMAP_LINEAR; |
180 | glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP; |
180 | glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP; |
181 | glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP; |
181 | glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP; |
182 | |
182 | |
|
|
183 | glGetError; |
183 | if (defined $data) { |
184 | if (defined $data) { |
184 | glTexImage2D GL_TEXTURE_2D, 0, |
185 | glTexImage2D GL_TEXTURE_2D, 0, |
185 | $self->{internalformat}, |
186 | $self->{internalformat}, |
186 | $self->{width}, $self->{height}, |
187 | $self->{width}, $self->{height}, |
187 | 0, |
188 | 0, |
188 | $self->{format}, |
189 | $self->{format}, |
189 | GL_UNSIGNED_BYTE, |
190 | GL_UNSIGNED_BYTE, |
190 | $data; |
191 | $data; |
|
|
192 | glGetError and die; |
191 | } else { |
193 | } else { |
192 | glCopyTexImage2D GL_TEXTURE_2D, 0, |
194 | glCopyTexImage2D GL_TEXTURE_2D, 0, |
193 | $self->{internalformat}, |
195 | $self->{internalformat}, |
194 | 0, 0, |
196 | 0, 0, |
195 | $self->{width}, $self->{height}, |
197 | $self->{width}, $self->{height}, |
196 | 0; |
198 | 0; |
197 | glPopmatrix; |
199 | glPopmatrix; |
198 | #SDL::GLSwapBuffers; |
|
|
199 | #sleep 1; |
|
|
200 | } |
200 | } |
201 | } |
201 | } |
202 | |
202 | |
203 | sub DESTROY { |
203 | sub DESTROY { |
204 | my ($self) = @_; |
204 | my ($self) = @_; |