PDA

View Full Version : FBO on Vista



devdept
08-06-2007, 09:13 AM
Hi All,

I am not able any more to use the FBO on Windows Vista.

The code works under Windows XP.

Is there something to keep in mind with FBO and Windows Vista we don't know?


Thanks a lot,

Alberto

CrazyButcher
08-06-2007, 11:13 AM
always give out more details, what type of FBO useage, and especially what driver/card version.

devdept
08-06-2007, 02:35 PM
You are right CrazyButcher, sorry!


We use the FBO to make a BMP out of our OpenGL scene. FBO is was (on XP) and it is (on Vista) the only way to get the specular highlights. If I well remember they where introduced in OpenGL 1.2 and the Microsoft OpenGL implementation is still 1.1 so the ImageDC does not allow to see the specular highlights. I had also heard about a Microsoft OpenGL 1.4 implementation on windows Vista but it does not seem like that.


We are working on an ATI FireGL 7200.


Thanks a lot,


Alberto

Trenki
08-06-2007, 03:05 PM
It's not exactly clear what you are trying to do. Specular highlights doesn't have anything to do with FBO! I think you are talking about the GL_EXT_separate_specular_color extension which was promoted to the OpenGL 1.2 core functionality.

Brolingstanz
08-06-2007, 04:01 PM
No offense, but I think it's pretty clear that devdept is a few slices short of a loaf.

zed
08-07-2007, 12:01 AM
as Trenki saiz the problem youre having has absolutly nothing to do with FBO

Relic
08-07-2007, 01:56 AM
Guess he just didn't express himself clearly enough. ;)

Reformatting the question would lead to this explanation:
To be able to render an offscreen bitmap image you either use a PFD_RENDER_TO_BITMAP pixelformat (on a device independent bitmap in a memory-DC) which will always use the Microsoft SW OpenGL 1.1 implementation or you render to an offscreen surface using FBOs (or p-buffers) and get the full set of hardware features.

Since you seem to need a specific OpenGL feature which isn't supported by Microsoft's OpenGL implementation your best option are harware accelerated offscreen surfaces.

Now with ATI FireGL V7200 under Vista you say you don't get FBOs?
Means you either have not installed a driver with a HW accelerated OpenGL installable client driver or the graphics driver you have doesn't support FBOs.
Check glGetString() GL_VENDOR and GL_EXTENSIONS.

In both cases the solution is to get a Vista driver for your board which supports OpenGL HW acceleration with the necessary features.

Look on the vendor's driver download site.
http://ati.amd.com/support/driver.html

This would be your best bet:
http://ati.amd.com/support/drivers/vista32/firegl-vista32.html

If that still doesn't provide the necessary features you're out of luck and the next steps depend on your schedules and budget.

devdept
08-07-2007, 02:05 AM
Hi Relic,

Lukily there is somebody who knows what I am talking about!

I will try to query the GL_EXTENSIONS to see if FBO are available.

I am suspicious about the type of FBO we are requesting: Do you see something wrong in the following lines of code?


uint uFramebuffer = gl.GenFramebuffersEXT();

#region Check for size overflow

// have to be called after GenFramebufferEXT()
gl.BindFramebufferEXT(gl.FRAMEBUFFER_EXT, uFramebuffer);

int maxSize = gl.GetIntegerv(gl.MAX_RENDERBUFFER_SIZE_EXT);

if (imageWidth > maxSize)

imageWidth = maxSize;

if (imageHeight > maxSize)

imageHeight = maxSize;

#endregion

uint uColorBuffer = gl.GenRenderbuffersEXT();
gl.BindRenderbufferEXT(gl.RENDERBUFFER_EXT, uColorBuffer);
gl.RenderbufferStorageEXT(gl.RENDERBUFFER_EXT, gl.RGB, imageWidth, imageHeight);
gl.FramebufferRenderbufferEXT(gl.FRAMEBUFFER_EXT, gl.COLOR_ATTACHMENT0_EXT, gl.RENDERBUFFER_EXT, uColorBuffer);

uint uDepthBuffer = gl.GenRenderbuffersEXT();
gl.BindRenderbufferEXT(gl.RENDERBUFFER_EXT, uDepthBuffer);
gl.RenderbufferStorageEXT(gl.RENDERBUFFER_EXT, gl.DEPTH_COMPONENT, imageWidth, imageHeight);
gl.FramebufferRenderbufferEXT(gl.FRAMEBUFFER_EXT, gl.DEPTH_ATTACHMENT_EXT, gl.RENDERBUFFER_EXT, uDepthBuffer);


bool result = gl.CheckFramebufferStatusEXT(gl.FRAMEBUFFER_EXT) == gl.FRAMEBUFFER_COMPLETE_EXT;Thanks again,

Alberto

Trenki
08-07-2007, 02:26 AM
If you realy need the functionality of GL_EXT_separate_specular_color and can't find the right drivers which support FBO you could still achieve the same effect even with OpenGL 1.1.
But doings so you would have to do multipass rendering which would probably complicate things a bit.

Relic
08-07-2007, 02:36 AM
If this works exactly the same way on WinXP, I wouldn't know why it should fail under Vista.

The FBO calls themself work? => Means the FBO extension is supported and you have a HW driver running.

Does just the CheckFramebufferStatus return an error?
I've heard sometimes on this forum that older ATI boards didn't support 24 bit depth with FBOs.

You could try some more explicit internalformats from the OpenGL 2.1 spec table 3.16 like GL_RGB8 GL_RGBA8 and GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT16 maybe. But that should be the same under WinXP.

GL_DEPTH_COMPONENT16 is most likely not supported on NVIDIA though. There 24 bits are preferred.
For cross vendor support you would need find a supported format iteratively. Try 24 bits first, then 16, then the generic DEPTH_COMPONENT. If none of these is framebuffer_complete, you're screwed. :p

If 16 bit depth helps to get the FBO complete on your board, that might still not suffice for all applications, because it could cost you depth buffer precision compared to a standard onscreen rendering with 24 bits depth.

devdept
08-07-2007, 02:37 AM
Thanks Trenki,

In the meantime I found the GLView.exe program (OpenGL Super Bible) that enumerates supported PixelFormats and Extensions.

For the choosen pixel format I see the GL_EXT_framebuffer_object listed.

I also double checked the driver version: it is exactly the one Relic suggested.

So the issue should be in our code?

Thanks,

Alberto

devdept
08-07-2007, 02:50 AM
Now we are sure,

The following code tell us the extension is present:


string extensionList = gl.GetString(gl.EXTENSIONS);

if (extensionList.Contains("GL_EXT_framebuffer_object")) {
...
}

devdept
08-07-2007, 03:00 AM
Relic,

The glCheckFramebufferStatus returns: 36055 => FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT

What does it mean?

Thanks a lot!

Alberto

devdept
08-07-2007, 03:30 AM
Hi All,

We also commented out the DEPTH buffer initialization, so now we are calling only:


uint uColorBuffer = gl.GenRenderbuffersEXT();
gl.BindRenderbufferEXT(gl.RENDERBUFFER_EXT, uColorBuffer);
gl.RenderbufferStorageEXT(gl.RENDERBUFFER_EXT, gl.RGB, imageWidth, imageHeight);
gl.FramebufferRenderbufferEXT(gl.FRAMEBUFFER_EXT, gl.COLOR_ATTACHMENT0_EXT, gl.RENDERBUFFER_EXT, uColorBuffer);And still getting: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT

Looks like there is no image attached to the framebuffer.

What else could we try?


Alberto

Relic
08-07-2007, 04:39 AM
As I said, try combinations of these:

gl.RenderbufferStorageEXT(gl.RENDERBUFFER_EXT, gl.RGB8, imageWidth, imageHeight);
gl.RenderbufferStorageEXT(gl.RENDERBUFFER_EXT, gl.RGBA8, imageWidth, imageHeight);

gl.RenderbufferStorageEXT(gl.RENDERBUFFER_EXT, gl.DEPTH_COMPONENT16, imageWidth, imageHeight);
gl.RenderbufferStorageEXT(gl.RENDERBUFFER_EXT, gl.DEPTH_COMPONENT24, imageWidth, imageHeight);

Try small imageWidth and height (maybe you ran out of video memory?)

And I normally unbind the renderbuffer before attaching it to the framebuffer:
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); // Unbind.

Something along the lines of this code:


glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, renderbufferColor);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, 64, 64);

glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, renderbufferDepth);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, 64, 64);

glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); // Unbind.

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, renderbufferColor);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, renderbufferDepth);

devdept
08-07-2007, 05:13 AM
Hi Relic,

I have double checked again and tryed all the option you gave me but the error is always: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT.

It should be something related to the graphics card driver I think.

Here is the code I am using:


uint uFrameBuffer = gl.GenFramebuffersEXT();

gl.BindFramebufferEXT(gl.FRAMEBUFFER_EXT, uFrameBuffer);

// ... checks for size overflow ...

uint uColorBuffer = gl.GenRenderbuffersEXT();
gl.BindRenderbufferEXT(gl.RENDERBUFFER_EXT, uColorBuffer);
gl.RenderbufferStorageEXT(gl.RENDERBUFFER_EXT, gl.RGB, imageWidth, imageHeight);
gl.FramebufferRenderbufferEXT(gl.FRAMEBUFFER_EXT, gl.COLOR_ATTACHMENT0_EXT, gl.RENDERBUFFER_EXT, uColorBuffer);

uint uDepthBuffer = gl.GenRenderbuffersEXT();
gl.BindRenderbufferEXT(gl.RENDERBUFFER_EXT, uDepthBuffer);
gl.RenderbufferStorageEXT(gl.RENDERBUFFER_EXT, gl.DEPTH_COMPONENT, imageWidth, imageHeight);
gl.FramebufferRenderbufferEXT(gl.FRAMEBUFFER_EXT, gl.DEPTH_ATTACHMENT_EXT, gl.RENDERBUFFER_EXT, uDepthBuffer);

gl.BindRenderbufferEXT(gl.FRAMEBUFFER_EXT, 0); // unbind

int status = gl.CheckFramebufferStatusEXT(gl.FRAMEBUFFER_EXT);I also try removing the: pixelFormat.SUPPORT_COMPOSITION for Windows Vista but nothing changed.

Thanks a lot to you all for the effort but this time looks harder than others.

Alberto