import com.sun.opengl.util.FBObject;
…
static IntBuffer fbo = BufferUtil.newIntBuffer(1);
static IntBuffer depth = BufferUtil.newIntBuffer(1);
static IntBuffer fbo_texture = BufferUtil.newIntBuffer(1);
…
static void initializeFBO(GLAutoDrawable drawable,int width, int height)
{
GL2 gl = drawable.getGL().getGL2();
gl.glGenFramebuffers(1, FSO_ENGINE.fbo);
!->> gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, FSO_ENGINE.fbo.get(0)); << -at this point the app gets memory error!
gl.glGenRenderbuffers(1, FSO_ENGINE.depth);
gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, FSO_ENGINE.depth.get(0));
gl.glRenderbufferStorage(GL2.GL_RENDERBUFFER, GL2.GL_DEPTH_COMPONENT24, width, height);
gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, 0);
gl.glFramebufferRenderbuffer(GL2.GL_FRAMEBUFFER, GL2.GL_DEPTH_ATTACHMENT, GL2.GL_RENDERBUFFER, FSO_ENGINE.depth.get(0));
gl.glGenTextures(1, FSO_ENGINE.fbo_texture);
gl.glBindTexture(GL.GL_TEXTURE_2D, FSO_ENGINE.fbo_texture.get(0));
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S , GL2.GL_CLAMP);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T , GL2.GL_CLAMP);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S , GL2.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T , GL2.GL_CLAMP_TO_EDGE);
gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE);
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, wid,hei, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, null);
gl.glViewport(0,0,width,height);
…
…
…