Bug 1365 : OpenGL internals called within stop()
Last modified: 2009-10-30 12:06




Status:
RESOLVED
Resolution:
WONTFIX -
Priority:
P2
Severity:
normal

 

Reporter:
threesixty3d
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2009-10-30 09:23
When using VBOs, textures, etc, it's a good idea to free/deallocate
resources on the gpu, using calls such as glDeleteBuffers() in case of
vertex buffers for example.

In c++ programs, this is usually done within the destructor that, I guess,
in processing should be equivalent to the stop() callback.

The problem is, within stop() the object returned by pgl.beginGL() looks
valid (apparently it's not null), but is somehow internally broken.
Within stop(), even something simple like gl.glGetString( GL.GL_VERSION )
returns a null string and everything that is tested with
glu.gluErrorString( gl.glGetError() ) returns "invalid operation".

Maybe this is also connected with bug 1364?

////////////////////////////////////////////////////////////////
// repro

import processing.opengl.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import com.sun.opengl.util.*;

// GL globals
GLU glu = new GLU();
PGraphicsOpenGL pgl;
GL gl;

void setup()
{
size( 640, 360, OPENGL );

pgl = (PGraphicsOpenGL) g;
gl = pgl.beginGL();

println( "GL > " + gl );
println( "version > " + gl.glGetString( GL.GL_VERSION ) );
println( glu.gluErrorString( gl.glGetError() ) );

pgl.endGL();
}

void stop()
{
pgl = (PGraphicsOpenGL) g;
gl = pgl.beginGL();

println( "GL > " + gl );
println( "version > " + gl.glGetString( GL.GL_VERSION ) );
println( glu.gluErrorString( gl.glGetError() ) );

pgl.endGL();
}
Additional Comment #1 From fry 2009-10-30 12:06
This would be an architectural nightmare. As stated in the reference, if
you're looking to do advanced OpenGL coding, you'll be happier using a
regular Java program, rather than trying to shoehorn advanced calls into a
Processing sketch.