PDA

View Full Version : FBO with float texture color attachment; GEForce 7



Leadwerks
03-16-2009, 08:18 PM
I can render to a float texture with no problems with my GEForce 8800. On my GEForce 7300 an incomplete FBO attachment error occurs when I try to set up the FBO. The code below works with GL_RGBA8 as format but fails with GL_LUMINANCE32F and GL_R32F.

I looked at the texture_rg spec, but it appears this should work. Please tell me if I need to do anything differently before I report it as a bug to NVidia. Thanks:

Strict

SetGraphicsDriver(GLGraphicsDriver());
Graphics(880,600);
glewinit();

Const GL_R32F=$822E

Local framebuffer:Int
Local texture:Int
Local format:Int=GL_R32F

glGenFramebuffersExt(1,Varptr framebuffer);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,framebuffe r);

glGenTextures(1,Varptr texture);
glBindTexture(GL_TEXTURE_2D,texture);
glTexImage2D(GL_TEXTURE_2D,0,format,512,512,0,GL_R GB,GL_UNSIGNED_BYTE,Null );
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_CO LOR_ATTACHMENT0_EXT,GL_TEXTURE_2D,texture,0);

Select glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)
Case GL_FRAMEBUFFER_COMPLETE_EXT
Notify("Everything is okay.");
Case GL_FRAMEBUFFER_UNSUPPORTED_EXT
Notify("FBO error: Configuration unsupported",1)
End;
Case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT
Notify("FBO error: Missing Attachment.",1);
End;
Case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT
Notify("FBO error: Incomplete format.",1);
End;
Case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT
Notify("FBO error: Incomplete draw buffer.",1);
End;
Case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
Notify("FBO error: Incomplete FBO attachment.",1);
End;
Default
Notify("FBO error: "+glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)+"!",1);
End;
EndSelect

End;

Leadwerks
03-16-2009, 08:33 PM
I just found the solution here, but will write it down for anyone who does a search on this forum:
ftp://download.nvidia.com/developer/Papers/2004/Vertex_Textures/Vertex_Textures.pdf


Vertex textures are bound using the standard texture calls, using the
GL_TEXTURE_2D texture targets. Currently only the
GL_LUMINANCE_FLOAT32_ATI and GL_RGBA_FLOAT32_ATI formats are
supported for vertex textures. These formats contain a single or four channels of
32-bit floating point data, respectively. Be aware that using other texture formats or
unsupported filtering modes may cause the driver to drop back to software vertex
processing, with a commensurate drop in interactive performance.