I’m getting an error when creating my frame buffer object:
GL gl = new DebugGL( drawable.getGL() );
int [] params = new int [1];
gl.glGenFramebuffersEXT( 1, params, 0 );
frameBufferID = params[0];
gl.glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, frameBufferID );
if ( (flags & PIXEL_BUFFER) != 0 )
{
pixelBufferID = bind( drawable );
gl.glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, null );
gl.glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, pixelBufferID, 0 );
}
else
{
gl.glDrawBuffer( GL_NONE );
gl.glReadBuffer( GL_NONE );
}
if ( (flags & DEPTH_BUFFER) != 0 )
{
gl.glGetIntegerv( GL_DEPTH_BITS, params, 0 );
int depthBits = params[0];
int depthFormat = (depthBits == 16) ? GL_DEPTH_COMPONENT16_ARB : GL_DEPTH_COMPONENT24_ARB;
gl.glGenTextures( 1, params, 0 );
depthBufferID = params[0];
gl.glBindTexture( GL_TEXTURE_2D, depthBufferID );
gl.glTexImage2D( GL_TEXTURE_2D, 0, depthFormat, width, height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, null );
gl.glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, depthBufferID, 0 );
// Set the texture quality
gl.glTexParameterf( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST );
gl.glTexParameterf( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST );
gl.glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER );
gl.glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER );
gl.glTexParameterfv( GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, new float[] {1f,1f,1f,1f}, 1 );
gl.glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE );
gl.glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL );
}
int status = gl.glCheckFramebufferStatusEXT( GL_FRAMEBUFFER_EXT );
if ( status != GL_FRAMEBUFFER_COMPLETE_EXT )
{
System.out.println( "*** Error: OffScreenRenderTarget did not set up frame buffer object correctly (" + status + ")" );
}
gl.glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
The return code from glCheckFramebufferStatusEXT() is GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT but it looks fine to me. Can anyone here spot my bad? (I’m running Windows XP, with ATI Radeon X1900 GT).