LWJGL
February 03, 2012, 23:04:44 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: FBO/texture problem  (Read 792 times)
pobrien
Newbie
*
Posts: 8


« on: March 06, 2010, 19:53:29 »

Hi,

   I'm having trouble with framebuffers. I've successfully done framebuffers in c/c++ and openGL, but I'm missing something. I get this error:
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT

I think it has something to do with the textureID. In c, I create a GLuint, and then do a glGenTextures, which is then
used for the fbo.

Any help is much appreciated, I've tried a bunch of things and nothing works!

Here is the code. Its pretty much straight from the wiki.
Code:
  IntBuffer texID = ByteBuffer.allocateDirect(1*4).order(ByteOrder.nativeOrder()).asIntBuffer();
GL11.glGenTextures(texID);
    
    boolean FBOEnabled = GLContext.getCapabilities().GL_EXT_framebuffer_object;

IntBuffer buffer = ByteBuffer.allocateDirect(1*4).order(ByteOrder.nativeOrder()).asIntBuffer(); // allocate a 1 int byte buffer
EXTFramebufferObject.glGenFramebuffersEXT( buffer ); // generate
int myFBOId = buffer.get();

EXTFramebufferObject.glBindFramebufferEXT( EXTFramebufferObject.GL_FRAMEBUFFER_EXT, myFBOId );
EXTFramebufferObject.glFramebufferTexture2DEXT( EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT,
               GL11.GL_TEXTURE_2D, texID.get(0), 0);

int framebuffer = EXTFramebufferObject.glCheckFramebufferStatusEXT( EXTFramebufferObject.GL_FRAMEBUFFER_EXT );
switch ( framebuffer ) {
case EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT:
break;
case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
throw new RuntimeException( "FrameBuffer: " + myFBOId
+ ", has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception" );
case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
throw new RuntimeException( "FrameBuffer: " + myFBOId
+ ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT exception" );
case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
throw new RuntimeException( "FrameBuffer: " + myFBOId
+ ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT exception" );
case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
throw new RuntimeException( "FrameBuffer: " + myFBOId
+ ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception" );
case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
throw new RuntimeException( "FrameBuffer: " + myFBOId
+ ", has caused a GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT exception" );
case EXTFramebufferObject.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
throw new RuntimeException( "FrameBuffer: " + myFBOId
+ ", has caused a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT exception" );
default:
throw new RuntimeException( "Unexpected reply from glCheckFramebufferStatusEXT: " + framebuffer );
}
Logged
Kai
Talks Too Much
***
Posts: 130


« Reply #1 on: March 07, 2010, 09:52:07 »

Hi,

as you would have to do it in C, too, you need to initialize the texture first before attaching it to the FBO with glTexImage2D after you generate the texID.
Logged
pobrien
Newbie
*
Posts: 8


« Reply #2 on: March 07, 2010, 10:59:58 »

i feel stupid, thanks for pointing that out, I'm not getting that error now.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!