
FBO off-screen-rendering problem
Posted Thursday, 7 May, 2009 - 08:44 by Shocker inI'd like to draw 3D directly to Screen. And I tried using WIN32 API - Layered Window with FBO.
It succeeded in creating transparency enabled window . But a problem has occurred in essential Drawing 3D .
Drawing surfaces of Cube was incorrectly . It seems that Depth buffer couldn't work well .
Could you tell me where a mistake is ?
| Attachment | Size |
|---|---|
| Form1.cs | 31.45 KB |


Comments
Re: FBO off-screen-rendering problem
To use depth test with FBOs, you have to attach a depth texture (or renderbuffer) first. In your PreparingGL_FBO method, create a texture using the DepthComponent internal format and attach it with:
Afterwards, depth test should work as expected.
Edit: Some drivers need you to specify the exact bitdepth of the texture, e.g. PixelInternalFormat.DepthComponent24.
Re: FBO off-screen-rendering problem
Thank you !
I have thought that the FBO needs a Depth texture when it is needed to get Depth buffer as an image .
Re: FBO off-screen-rendering problem
Yes, texture attachements is needed when you want to get rendered image (depth or color) as texture. If you don't, then use renderbuffer attachment.
Re: FBO off-screen-rendering problem
I haven't understood use of Render buffer clearly .
Thanks to you, I get a some knowledge .
Re: FBO off-screen-rendering problem
Hi i am currently drawing offscreen to a renderbuffer attached to and FBO. I need to display the contents of the FBO back to "on-screen" i.e. the window. How can you do that without having to go to main memory by using the glreadpixels() and gldrawpixels()? If i should use glcopypixels() how can i do that because i am trying to get that working and only getting a blank screen back!
glBindFramebufferEXT(GL_READ_FRAMEBUFFER,bufferID);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER,0);
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
glDrawBuffer(GL_FRONT);
glRasterPos2d(0.0, 0.0);
glCopyPixels(0, 0, 500, 500, GL_COLOR);
Do i need to use renderbuffer for better performance or can i just use the texture, as with the latter averything is working fine?
Re: FBO off-screen-rendering problem
You need to use GL.BlitFramebuffer to copy ("resolve") the renderbuffer to a texture.
The main difference between renderbuffers and textures are that the former can be multisampled while the latter generally cannot (unless the drivers expose multisampled textures, and many do not).
Re: FBO off-screen-rendering problem
so if the extension for blitting is not supported on the graphics card renderer then there is no other way i can do this pixel transfer?
Re: FBO off-screen-rendering problem
Unless you use a multisampled render target, glCopyPixels should work.
I don't know if you can copy directly to GL_FRONT, however. It may be possible, but I have never tried this - I always use an intermediate texture, first. Try using GL_BACK.
Re: FBO off-screen-rendering problem
i tried to use GL_BACK but still all i am getting are just artifacts (parts of the desktop current windows) rather than my drawing