Main Menu

FBO problems

Started by HangDude, August 01, 2006, 10:41:07

Previous topic - Next topic

HangDude

Hi!

I'm having problems with the Frame Buffer Object extension. All i want to do, is render screen to a texture and then put this on a grid that aligns to the screen so that i can then deform the texture coordinates and create water / wave effect.

But whatever I try, i get a EXTFramebufferObject.GL_FRAMEBUFFER_UNSUPPORTED_EXT when i check from Frame Buffer Object completeness.

Any help greatly appreciated

frameBuffer and texture are int fields in the encapsulating class, width and height are power of 2, (1024 both of them atm) and passed into the function

IntBuffer ib_fb = BufferUtils.createIntBuffer(1);
IntBuffer ib_tex = BufferUtils.createIntBuffer(1);
    
//  create objects
EXTFramebufferObject.glGenFramebuffersEXT(ib_fb);        // frame buffer
GL11.glGenTextures(ib_tex);              // texture
    
Util.checkGLError();
   
frameBuffer = ib_fb.get(0);
texture = ib_tex.get(0);


//  initialize texture
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB8, width, height, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (IntBuffer)null);

GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
    
    
EXTFramebufferObject.glBindFramebufferEXT (EXTFramebufferObject.GL_FRAMEBUFFER_EXT, frameBuffer);
//     (set texture parameters here)
//     attach texture to framebuffer color buffer
EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT   , EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D, texture, 0);

checkFrameBufferStatus();


where checkFrameBufferStatus does the following:

int status = EXTFramebufferObject.glCheckFramebufferStatusEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT);
switch(status) {
   case EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT:
     Logger.error("FrameBuffer is complete!");
    break;
   case EXTFramebufferObject.GL_FRAMEBUFFER_UNSUPPORTED_EXT:
       Logger.error("Unsupported EXT");
       break;
     default:
       /* programming error; will fail on all hardware */
       assert(false);
 }


I run this on an integrated NV 6100 grafik chipset which has the extension, but the same problems comes up on a FX5200

Thank you in advance,
phil

Philipp Aumayr
Rarebyte Game Development
www.rarebyte.com

darkprophet

We solved this over at #lwjgl, but i'll post here for completeness (punn unintended)

You haven't specified a GL_TEXTURE_MIN_FILTER or a GL_TEXTURE_MAG_FILTER on the texture, and nvidia seem to be picky about those...

Also, RGB8 might not be supported by the FBO...check for that too.

DP

HangDude

DarkProphet from #lwjgl brought up the solution: the MIN and MAG Filters need to be set on the texture. that's what was missing.

adding those min and mag filter setups after glTextImage2D did the trick..

also, changing the texture format from RGB8 to RGBA seemed to help a bit..

hope that helps if anyone else has probs..


phil

Philipp Aumayr
Rarebyte Game Development
www.rarebyte.com