PDA

View Full Version : FBO problem: FBO can not "capture" scene to GL_RGBA texture?



spring
10-07-2006, 05:33 PM
Hi:

I have a FBO problem !

=====================
Following code can run well
=====================
glBindTexture(GL_TEXTURE_2D, m_Texture[2]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_Width, m_Height,0, GL_RGB,GL_FLOAT, 0);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
..........
..........
m_fbo.Bind();
m_fbo.AttachTexture(GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_Texture[2]);

===============================================
if I change the internformat to GL_RGBA,program can not run ,and error message is
"glift::CheckFramebufferStatus() ERROR:
GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT" ,It is mean FBO can not "capture" scene to GL_RGBA texture? I want to confirm it ,If it's true, have any others way to do it ? I need to save alpha to next step?
===============================================


glBindTexture(GL_TEXTURE_2D, m_Texture[2]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_Width, m_Height,0, GL_RGBA,GL_FLOAT, 0);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

..........
..........
m_fbo.Bind();
m_fbo.AttachTexture(GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_Texture[2]);

Komat
10-08-2006, 08:00 AM
Are you using more than one attachment? The specification describes condition whose failure will cause this error as:



All images attached to the attachment points COLOR_ATTACHMENT0_EXT through COLOR_ATTACHMENTn_EXT must have the same internal format.

k_szczech
10-08-2006, 10:26 PM
I'm using FBO with RGBA - no problems.
Try changing your texture format to GL_RGBA8, GL_RGB_FLOAT16 or so - perhaps when you specify just GL_RGB it's stored as 16-bit texture (default texture quality). Specifying exact quality should guarantee that texture will be stored in this format if it's supported by HW.

brtnrdr
10-09-2006, 06:45 AM
I've had problems in the past attaching some combinations of texture formats and filtering methods with certain drivers. You might consider trying it with different drivers.