File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -262,12 +262,16 @@ sub togl {
262262sub DESTROY {
263263 my ($this ) = @_ ;
264264 print " DESTROY $this \n " if $PDL::Graphics::TriD::verbose ;
265- my $bound = glGetIntegerv_p(GL_ARRAY_BUFFER_BINDING);
266265 my @array_bufs = grep defined , @{ $this -> {Impl } }{qw( vert_buf color_buf norm_buf texc_buf) };
267- glBindBuffer(GL_ARRAY_BUFFER, 0) if grep $bound == $_ , @array_bufs ;
268- $bound = glGetIntegerv_p(GL_ELEMENT_ARRAY_BUFFER_BINDING);
266+ if (@array_bufs ) {
267+ my $bound = glGetIntegerv_p(GL_ARRAY_BUFFER_BINDING);
268+ glBindBuffer(GL_ARRAY_BUFFER, 0) if grep $bound == $_ , @array_bufs ;
269+ }
269270 my @elt_bufs = grep defined , @{ $this -> {Impl } }{qw( indx_buf) };
270- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) if grep $bound == $_ , @elt_bufs ;
271+ if (@elt_bufs ) {
272+ my $bound = glGetIntegerv_p(GL_ELEMENT_ARRAY_BUFFER_BINDING);
273+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) if grep $bound == $_ , @elt_bufs ;
274+ }
271275 glDeleteBuffers_p(@array_bufs , @elt_bufs ) if @array_bufs + @elt_bufs ;
272276 if (defined (my $tex_id = $this -> {Impl }{tex_id })) {
273277 glBindTexture(GL_TEXTURE_2D, 0) if glGetIntegerv_p(GL_TEXTURE_BINDING_2D) == $tex_id ;
You can’t perform that action at this time.
0 commit comments