FBO (convert to jogl2 problem) (update:solution found)

hello @all,

i work a long time with jogl1 and fbo and all works fine.

now i switched to jogl2 and the FrameBufferObjects will not work anymore.

some parts of my jogl1 init code


	GL gl = drawable.getGL();

	        gl.glGenFramebuffersEXT(1, fbo);
	        gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, fbo.get(0));
	        gl.glGenRenderbuffersEXT(1, depth);
	        gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, depth.get(0));
	        gl.glRenderbufferStorageEXT(GL.GL_RENDERBUFFER_EXT, GL.GL_DEPTH_COMPONENT24, fbo_width, fbo_height);
	        gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, 0);
	        gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, GL.GL_RENDERBUFFER_EXT, depth.get(0));
	        gl.glGenTextures(1, fbo_texture);

in jogl2 (GL2 gl = drawable.getGL().getGL2(); // GL->GL2)
it will not work,break with unknown commands(can not find symbol)

is there any basic FrameBufferObject JOGL2 tutorial?
(google only find jogl1 tutorials)

thx for any help :slight_smile:

The FrameBufferEXT functions was the Problem.

i convert all existing Code direct like:
GL gl = drawable.getGL(); -> GL2 gl = drawable.getGL().getGL2();

…Init FBO (new)

    gl.glGenFramebuffers(1, fbo);
gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fbo.get(0));
gl.glGenRenderbuffers(1, depth);
gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, depth.get(0));
gl.glRenderbufferStorage(GL2.GL_RENDERBUFFER, GL2.GL_DEPTH_COMPONENT24, fbo_width, fbo_height);
gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, 0);
gl.glFramebufferRenderbuffer(GL2.GL_FRAMEBUFFER, GL2.GL_DEPTH_ATTACHMENT, GL2.GL_RENDERBUFFER, depth.get(0));
gl.glGenTextures(1, fbo_texture);

…Draw to FBO
Jogl1: gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, fbo.get(0));
->
Jogl2: gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, fbo.get(0));

…the solution was to remove the “EXT” and “_EXT”

these are changes reflects by OpenGL3 changes

thanks for that info.

JOGL2 also contains a nice FBO wrapper class which handles most of the functionality for binding FBOs, etc. -sj