PDA

View Full Version : FBO problems



dukey
03-17-2011, 05:22 PM
In my program I am rendering to an FBO multiple times. On ATI/Nvidia this works perfectly. I check my FBOs when I create them and they give no errors (attach correctly). After a frame has completed rendering I call glGetError() no errors are received. It works fine.

Now .. on Intel cards I have this strange problem where

glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)

does absolutely nothing. It just wont work. I can't clear the colour or depth buffer, at the same time or independently.

On ATI/Nvidia it looks like this

http://i126.photobucket.com/albums/p95/dukeeeey/gfx%20stuff/Image2.png

On Intel ..

http://i126.photobucket.com/albums/p95/dukeeeey/gfx%20stuff/image1.png

I am really at a loss to explain this one. I'm at the point where I might have to try and simulate glClear just by drawing a quad with depth testing disabled.

Any ideas? I'm losing my hair here !

McLeary
03-17-2011, 08:16 PM
I don't know if this is relevant, but are you setting the clear values before the glClear() call?

Maybe the drivers for the intel doesn't keep this values as a state (just a guess).

randall
03-18-2011, 03:00 AM
What driver version/graphics card model? Can you post some code to show how you setup FBO?

dukey
03-18-2011, 03:33 AM
It's a mobile intel series (4) express chipset family
Common in laptops
Says its running opengl version 2.1
build 8.15.10.2182

And yeah I am setting the clear colour before calling glclear. Theres a bunch of things gonna try today, flushing the pipeline before asking for the texture. I was using stencil when rendering to the back buffer, maybe that's somehow effecting it.

randall
03-18-2011, 03:39 AM
Check if your FBO is complete after setup code.

Dan Bartlett
03-18-2011, 05:05 AM
From OpenGL 4.1 spec:


When Clear is called, the only per-fragment operations that are applied (if enabled) are the pixel ownership test, the scissor test, and dithering. The masking operations described in section 4.2.2 are also applied.

So, from this, do you have the scissor rect set to the area required + color/depth/stencil masks allowing clearing to occur.

The other difference I can see is that according to GLview, the Intel setup only supports GL_EXT_framebuffer_object, whereas NVidia + ATI cards probably support both GL_ARB_framebuffer_object + GL_EXT_framebuffer_object, so maybe there is some extra restriction that is relaxed with the ARB version of the extension?

Perhaps clearing the depth + stencil buffers at the same time might help too. If they are shared, then this should be faster than clearing them separately anyway.

dukey
03-18-2011, 05:30 AM
glScissor ?
worth a shot ..

dukey
03-18-2011, 06:49 AM
How can I clear the depth buffer .. without using glclear ?

Edit:
Never mind I figured it out. Well, I figured out what's going wrong. For some reason when i call
glClear it clears the viewport, but the size of a much smaller FBO ..

Manually clearing the colour and depth buffers does work. This is really insane, I shouldn't have to do this :(

dukey
03-18-2011, 02:42 PM
Well ..
I got it to work using this code



glEnable (GL_DEPTH_TEST);
glDepthFunc (GL_GEQUAL);
glLoadIdentity ();
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();

glBegin (GL_QUADS);
glVertex3f (-1,-1,1);
glVertex3f (1,-1,1);
glVertex3f (1,1,1);
glVertex3f (-1,1,1);
glEnd ();

glMatrixMode (GL_MODELVIEW);
glColor4f (1.0f,1.0f,1.0f,1.0f);
glDisable (GL_DEPTH_TEST);
glDepthFunc (GL_LESS);


Which which manually, clears the colour and depth buffer. You can see the viewport is correct since the above code does what glClear fails to do ..

But other problems occur

http://i126.photobucket.com/albums/p95/dukeeeey/gfx%20stuff/image1-1.png

You can see the shadow has strange artifacts, again this doesn't happen with Nvidia/ATI.

Anyone else try to code for Intel graphics cards? Intel market share is something like 50%, i'd like to try and support these things if possible .. but driver bugs are really kicking my ass

JoshKlint
03-18-2011, 07:44 PM
I suggest making a fallback renderer for Intel chips that uses minimal functionality. They're going to perform like crap anyways, so you might as well cut out all the features, instead of trying to run the same code on Intel chips and a real GPU.