Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 12-11-06, 06:56 AM   #1
georg
Registered User
 
Join Date: Jun 2003
Posts: 24
Default Frame buffer object with RGBA+z doesn't work for me..

Hi,

am I doing something wrong? This is on a 7900 with 96.31 drivers; I'm trying to get an off-screen buffer with RGBA and Depth. The following results in
GL_FRAMEBUFFER_UNSUPPORTED_EXT. If I leave out the depth buffer bits and just use RGBA, it works just fine.... I thought nvidia said RGBA+Z was supported everywhere?

Code:
GLuint FrameTex;
glGenTextures(1, &FrameTex);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB,FrameTex);
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 
             GL_RGBA, 640, 480, 0, 
             GL_RGBA, GL_UNSIGNED_BYTE, NULL); 
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

GLuint DepthBuffer;
glGenRenderbuffersEXT(1, &DepthBuffer);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthBuffer);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, 640, 480);

GLuint FrameBuffer;
glGenFramebuffersEXT(1, &FrameBuffer);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FrameBuffer); 
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, 
			    GL_TEXTURE_RECTANGLE_ARB, FrameTex, 0);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, 
  			       GL_RENDERBUFFER_EXT, DepthBuffer);
  

CheckFramebufferStatus();
georg is offline   Reply With Quote
Old 12-15-06, 12:23 PM   #2
georg
Registered User
 
Join Date: Jun 2003
Posts: 24
Default Re: Frame buffer object with RGBA+z doesn't work for me..

Bump. Anyone have any experience with this?

Attached nvidia bug report output.
Attached Files
File Type: zip br.zip (21.0 KB, 139 views)
georg is offline   Reply With Quote
Old 01-26-07, 11:42 AM   #3
georg
Registered User
 
Join Date: Jun 2003
Posts: 24
Default Re: Frame buffer object with RGBA+z doesn't work for me..

Bump again, last try.
georg is offline   Reply With Quote
Old 01-27-07, 11:29 AM   #4
squeen
Registered User
 
Join Date: Dec 2006
Location: Greenbelt, MD
Posts: 33
Default Re: Frame buffer object with RGBA+z doesn't work for me..

Here are two methods that work for me ( 8800GTX, Quadro FX 4500 & Quadro FX 5500). The first creates and off-screen render target which can be read back using glReadPixels(), the other is a render to texture.
Code:
   GLuint   fb, color_rb, depth_rb, rgba_tex, depth_tex, i;
   
   glGenFramebuffersEXT(1, &fb);
   glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, fb );
switch (rtarget->class) {
      case CnFramebufferObjectRenderTargetClass:
         /* depth render buffer */
         glGenRenderbuffersEXT(1, &depth_rb);
         glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, depth_rb );
         glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, rtarget->width, rtarget->height );
         glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_rb );         
         rtarget->fbo.depth_attach = depth_rb;
         /* color render buffer */
         glGenRenderbuffersEXT(1, &color_rb);
         glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, color_rb );
         glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_RGBA8, rtarget->width, rtarget->height );
         glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, color_rb );
         rtarget->fbo.color_attach[0] = color_rb;
         break;
      case CnRGBATextureRenderTargetClass:
                  
         /* RGBA texture  */
         glGenTextures(1, &rgba_tex);
         glBindTexture(GL_TEXTURE_2D, rgba_tex);
         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
         glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, rtarget->width, rtarget->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
         glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, rgba_tex, 0 );         
         rtarget->fbo.color_attach[0] = rgba_tex;
         cnCheckGLerrors("cnNewFramebufferObject: fbo rgba texture");
         
         /* depth render buffer */
         glGenRenderbuffersEXT(1, &depth_rb);
         glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, depth_rb );
         glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, rtarget->width, rtarget->height );
         glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_rb );         
         rtarget->fbo.depth_attach = depth_rb;
         cnCheckGLerrors("cnNewFramebufferObject: fbo depth render buffer");
         
         break;
}
squeen is offline   Reply With Quote
Old 01-29-07, 07:46 AM   #5
georg
Registered User
 
Join Date: Jun 2003
Posts: 24
Default Re: Frame buffer object with RGBA+z doesn't work for me..

Thanks for that - that seems to work fine. Upgrading to 97.46 seems to have fixed my code as well! Despite there not being any indication of a change in the nvidia changelog...

Cheers
georg is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:44 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.