Picking objects without GL_ARB_framebuffer_object extension


I have created a 3d viewer and i use color picking via FBO. Some computers fails to do the picking, with the error:

“Unable to find an entry point named ‘glGenRenderbuffers’ in DLL ‘opengl32.dll’.”

To get around this, i check if FBO (extension GL_ARB_framebuffer_object) is available. If not, I want to do picking another way…

I have read that ray tracing is a viable way. However my objects in the scene can have MANY triangles, and doing a line-triangle hittest on many triangles will be slow at best.

What are my options?


You probably anyways have some space partitioning system setup (e.g. BVHs = Bounding Volume Hierarchies), if not, you probably need one anyways if you want your viewer to be scalable.
You can use your space partitioning system as an acceleration structure for your ray casting code. This way the coarse tests will get rid of most of the triangles you have to test against.

this might be a silly suggestion but have you tried using glGenFramebuffers(1, &FBO); insted of glGenRenderbuffers?

You could render the color picking image to the back buffer, but not swap buffers.

Hi all, thanks for the replies.


All my objects are always within frustrum so BVHs does not help me render faster and i have therefore not implemented it. However, could be an idea for speeding up ray tracing. Nonetheless, I would prefer a simpler solution if one is available.


The extension is not available, so trying an overload will not help me :frowning:

>>carsten neumann

Is it possible to extract pixel information from the back buffer?

What about pixel buffers, would that work in my situation?

Is it possible to extract pixel information from the back buffer?

Yes, glReadPixels() reads from the current read buffer, which can be GL_BACK. What are you using to get at the pixel information in the FBO attachment?

With pixel buffers do you mean WGL_pbuffer? AFAIK those were the predecessor to FBOs, but less flexible. I don’t know the differences/limitations in detail or if they matter for your use case, my completely gut based feeling would be that you probably can use pbuffers.

>>carsten neumann

When getting the error i have not started to set pixel information. The error is when calling glGenRenderbuffers (error states that function it is not found in opengl32.dll).

I made the backbuffer work on my local machine, thanks. I will let you know the outcome on my clients computer. Seems that using the backbuffer is more generic instead of FBO …