anathema's picture

BindFramebuffer() returning InvalidOperation error

Project:The Open Toolkit library
Version:1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I'm running the following lines of code:

uint fbo;
GL.GenFramebuffers(1, out fbo);
GL.BindFramebuffer(FramebufferTarget.Framebuffer, fbo);

GenFramebuffers() is returning a valid ID, and GL.GetError() confirms that there are no problems at this stage. BindFramebuffer() generates an 'Invalid Operation' error when executed. Calling BindFramebuffer() with a zero for the second parameter is fine.

This is all happening on an ATI x1200 card under Windows7 32-bit, and as it's an ATI I strongly suspect the culprit to be their lousy drivers, but I was wondering if anyone else had seen this? The above code works perfectly on my Nvidia card.

I've also tried running the OpenTK FramebufferObject example, which does exactly the same thing.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ebnf's picture

#1

You're likely running into a framebuffer completeness issue; early versions of the framebuffer extensions had very strict requirements that are complex to discover and meet. Newer extensions and drivers have subsequently relaxed some of the restrictions, likely what you're seeing with the nVidia card. See §4.4.4 of http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt for details of the framebuffer complete.

anathema's picture

#2

AIUI it is necessary to bind the fbo before I can attach textures/renderbuffers to it, yes? Certainly all the example code I've found online shows it being done in this order:

GenFramebuffers()
BindFramebuffer()
GenRenderbuffers()
BindRenderbuffer()
RenderbufferStorage()
FramebufferRenderbuffer()

The failure occurs exactly after the lines of code I posted - long before I try to attach buffers to the fbo.

the Fiddler's picture

#3

Try calling the Ext version of the functions, i.e: GL.Ext.GenFramebuffers() etc.

Core FBOs are a GL 3.x feature and the X1200 is a GL 2.1 card.

anathema's picture

#4

For reasons which escape me, it's suddenly started working with my code (although the OpenTK example still crashes). It doesn't appear to matter whether I use the Ext versions of the functions or not - either works (or doesn't work).

Incidentally, I think the last parameter to GL.Ext.BlitFramebuffer() may be incorrect - can you check?

I now have a new problem on this card...BlitFramebuffer() causes an InvalidOperation error if:

- the fbo is multisample (the card does support this extension)
- the blit includes a depth-buffer (both the source and target have 24-bit depth-buffers attached)

Once again, the code works fine on my Nvidia :-(

anathema's picture

#5

(To forestall the obvious question - I've checked that the fbo is complete before calling Blit :-)

anathema's picture

#6

I've found the cause of the error when blitting the depth-buffer: changing the RenderbufferStorage for the buffer from DepthComponent24 to Depth24Stencil8 stops the crash. I don't understand *why*, however, since my GraphicsContext does not have any stencil buffers...!

The problem now is that my ATI card is flipping the image written into the fbo top-to-bottom. This one really does appear to be a driver bug :-(

the Fiddler's picture

#7

Status:open» closed

Closing this issue due to age.