PDA

View Full Version : FBO driving me crazy..



qzm
04-18-2005, 10:32 PM
Please forgive me if I am doing something stupid but:
I just CANNOT get a working FBO...
Running the nvidia drivers 76.41, and using glew 1.3.2 for initialisation.

No matter what I seem to try I get a GL_FRAMEBUFFER_UNSUPPORTED_EXT return.
I have tried turning on and off depth testing, selecting GL_NONE as my drawbuffer, RGB and RGBA formats, and am fast running out of ideas.

Some people have mentioned changing control panel options, any ideas which?

I have tried literally dozens and dozens of combinations, with no luck at present. I REALLY do not want to go back to pbuffers....

I dont even need a texture for the colour target, although a renderbuffer works no better, as I only want to read the RGBA back out to memory.

Any help would be greatly appreciated.

I do the following:
glGenFramebuffersEXT(1,tmpbuffer)
self.fb=tmpbuffer[0]
glGenRenderbuffersEXT(2,tmpbuffer)
self.rb=tmpbuffer[0]
self.depth=tmpbuffer[1]
glGenTextures(1,tmpbuffer)
self.tex=tmpbuffer[0]
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,self.fb)

#texture method
glBindTexture(GL_TEXTURE_2D,self.tex)
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,512,512,0,GL _RGBA,GL_UNSIGNED_BYTE,0)
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST)
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_CO LOR_ATTACHMENT0_EXT,GL_TEXTURE_2D,self.tex,0)

#renderbuffer method
#glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,self.rb )
#glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_R GBA8,512,512)
#glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,G L_COLOR_ATTACHMENT0_EXT,GL_RENDERBUFFER_EXT,self.r b)

glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,self.dep th)
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_DE PTH_COMPONENT24,512,512)
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,GL _DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT,self.dep th)

status=glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_ EXT)
if status!=GL_FRAMEBUFFER_COMPLETE_EXT:
print "framebuffer error status=",<int>status

Java Cool Dude
04-19-2005, 06:03 AM
I'm using GLee and I got them to work pretty decently in a couple of demos.

Matt Zamborsky
04-19-2005, 06:59 AM
you can try to download demos, which are in the NVIDIA Forceware 75.90 => OpenGL 2.0.0 & fbo thread. I think someone posted one and i posted one on using floating buffer on NV3x hw. So download them and try . If you get still the same error, go to control panel, set/unset every setting and try to reinstall driver. It helped me :)

Java Cool Dude
04-19-2005, 07:05 AM
Try these two demos and tell me what does the lower left panel says. If FBO is detected, it will display GL_FRAMEBUFFER_EXT, otherwise they will fall back to using PBuffers.

Screenshot 1 (http://www.realityflux.com/abba/C++/Stained%20Shadow%20Maps/StainedShadowMaps.jpg)
Screenshot 2 (http://www.realityflux.com/abba/C++/Stained%20Shadow%20Maps/StainedShadowMaps2.jpg)
Binaries (http://www.realityflux.com/abba/C++/Stained%20Shadow%20Maps/StainedShadowMaps.zip)

Screenshot (http://www.realityflux.com/abba/C++/GLSLReflRefrChrm/Refl%20Refr%20Chrm%20Aberr.jpg)
Binaries (http://www.realityflux.com/abba/C++/GLSLReflRefrChrm/ReflRefrChrmAberr.zip)

Nithos
04-19-2005, 07:26 AM
First try this check to make sure you are supported.


CHECK_FRAMEBUFFER_STATUS()
{
printf("Checking framebuffer status.\n");
GLenum status;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
switch(status) {
case GL_FRAMEBUFFER_COMPLETE_EXT:
printf("Framebuffer complete.\n");
break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
printf("Framebuffer unsupported.\n");
/* choose different formats */
break;
default:
/* programming error; will fail on all hardware */
assert(0);
}
} Other than that doesnt look much different than mine, myabe your ourdeing is wrong, do u get it working and only getting a black or white screen?

Anyway here is what i'm doing

glGenTextures(1,&amp;color_tex);
glBindTexture(GL_TEXTURE_2D,color_tex);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,512,512,0,GL_ RGBA,GL_INT,0);

glGenRenderbuffersEXT(1, &amp;depth_rb);
//initialize depth renderbuffer
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,depth_rb );
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_DE PTH_COMPONENT24,512,512);

glGenFramebuffersEXT(1, &amp;fb);
//initialize frame buffers
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_CO LOR_ATTACHMENT0_EXT,GL_TEXTURE_2D,color_tex,0);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,GL _DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT,depth_rb );

CHECK_FRAMEBUFFER_STATUS();

qzm
04-19-2005, 12:09 PM
Originally posted by Java Cool Dude:
Try these two demos and tell me what does the lower left panel says. If FBO is detected, it will display GL_FRAMEBUFFER_EXT, otherwise they will fall back to using PBuffers.
Thank you for that, I have already run the second demo, and it certainly does use GL_FRAMEBUFFER_EXT, so I'm pretty sure I have basic driver support, there is just something subtle about getting it to hook..

I guess I will just have to keep playing at things and hope I find the right combination.

mogumbo
04-19-2005, 01:48 PM
Since everyone is writing demos :) -> http://www.reallyslick.com/src/fbo.zip

Mine is *very* simple; just enough to prove to myself that FBO works and is really cool. I really like how simple the API is.

glkat
04-20-2005, 02:51 PM
Try adding

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST)

I too kept getting the UNSUPPORTED_FORMAT error when I left out the MAG and MIN filter settings.

qzm
04-25-2005, 12:39 AM
Originally posted by glkat:
Try adding

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST)

I too kept getting the UNSUPPORTED_FORMAT error when I left out the MAG and MIN filter settings.Well, spotted, damn my poor cut/paste ability, that was 1/2 the problem! I also played with the order of a few other things and now seem to have it working.

Interestingly now the pure 2 Renderbuffer (depth+colour) method also works, which shows that it was not just the bungled texparameter :p

At present this stuff seems to be VERY sensitive to setup order, oh well so long as something works.