PDA

View Full Version : Cubemap FBO's on some ATI cards...lots of info



halo
01-02-2007, 11:28 AM
A few of my users are experiencing crashes when my engine renders a cubemap. The engine renders 6 faces of a cubemap straight to the texture, with an FBO. The routine works fine on my NVidia GE Force 7800 and ATI Radeon 9550.

Problem user's information:
OpenGL version 2.0.6067 WinXP Release
OpenGL vendor: ATI Technologies Inc.
OpenGL render device: RADEON X800 XL x86/SSE2

Code for initializing the cubemap and FBO:

programlog "Creating buffers..."

'Initialize FBO
If Not framebuffer[0]
For n=0 To 5
glGenFramebuffersEXT 1,Varptr framebuffer[n]
glGenRenderbuffersEXT 1,Varptr renderbuffer[n]
Next
EndIf

programlog "Creating cubemap..."

If Not gltexture
gldisable GL_TEXTURE_2D
glenable GL_TEXTURE_CUBE_MAP
glGenTextures 1,Varptr glTexture
glBindTexture GL_TEXTURE_CUBE_MAP,glTexture
glTexParameteri GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MIN_FILTER,GL_LINEA R'_MIPMAP_NEAREST
glTexParameteri GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MAG_FILTER,GL_LINEA R
glTexParameteri GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_ EDGE
glTexParameteri GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_ EDGE
glTexParameteri GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_R,GL_CLAMP_TO_ EDGE

programlog "Binding buffers..."

'Set up cubemap faces
glBindFramebufferEXT GL_FRAMEBUFFER_EXT,framebuffer[1]
glBindRenderbufferEXT GL_RENDERBUFFER_EXT,renderbuffer[1]
glRenderbufferStorageEXT GL_RENDERBUFFER_EXT,GL_DEPTH_COMPONENT,width,heigh t
glFramebufferRenderbufferEXT GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_REND ERBUFFER_EXT,renderbuffer[1]
glTexImage2D GL_TEXTURE_CUBE_MAP_POSITIVE_X,0,GL_RGB,width,heig ht,0,GL_RGB,GL_UNSIGNED_BYTE,Null
glFramebufferTexture2DEXT GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEX TURE_CUBE_MAP_POSITIVE_X,glTexture,0

glBindFramebufferEXT GL_FRAMEBUFFER_EXT,framebuffer[0]
glBindRenderbufferEXT GL_RENDERBUFFER_EXT,renderbuffer[0]
glRenderbufferStorageEXT GL_RENDERBUFFER_EXT,GL_DEPTH_COMPONENT,width,heigh t
glFramebufferRenderbufferEXT GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_REND ERBUFFER_EXT,renderbuffer[0]
glTexImage2D GL_TEXTURE_CUBE_MAP_NEGATIVE_X,0,GL_RGB,width,heig ht,0,GL_RGB,GL_UNSIGNED_BYTE,Null
glFramebufferTexture2DEXT GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEX TURE_CUBE_MAP_NEGATIVE_X,glTexture,0

glBindFramebufferEXT GL_FRAMEBUFFER_EXT,framebuffer[2]
glBindRenderbufferEXT GL_RENDERBUFFER_EXT,renderbuffer[2]
glRenderbufferStorageEXT GL_RENDERBUFFER_EXT,GL_DEPTH_COMPONENT,width,heigh t
glFramebufferRenderbufferEXT GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_REND ERBUFFER_EXT,renderbuffer[2]
glTexImage2D GL_TEXTURE_CUBE_MAP_POSITIVE_Y,0,GL_RGB,width,heig ht,0,GL_RGB,GL_UNSIGNED_BYTE,Null
glFramebufferTexture2DEXT GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEX TURE_CUBE_MAP_POSITIVE_Y,glTexture,0

glBindFramebufferEXT GL_FRAMEBUFFER_EXT,framebuffer[3]
glBindRenderbufferEXT GL_RENDERBUFFER_EXT,renderbuffer[3]
glRenderbufferStorageEXT GL_RENDERBUFFER_EXT,GL_DEPTH_COMPONENT,width,heigh t
glFramebufferRenderbufferEXT GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_REND ERBUFFER_EXT,renderbuffer[3]
glTexImage2D GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,0,GL_RGB,width,heig ht,0,GL_RGB,GL_UNSIGNED_BYTE,Null
glFramebufferTexture2DEXT GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEX TURE_CUBE_MAP_NEGATIVE_Y,glTexture,0

glBindFramebufferEXT GL_FRAMEBUFFER_EXT,framebuffer[4]
glBindRenderbufferEXT GL_RENDERBUFFER_EXT,renderbuffer[4]
glRenderbufferStorageEXT GL_RENDERBUFFER_EXT,GL_DEPTH_COMPONENT,width,heigh t
glFramebufferRenderbufferEXT GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_REND ERBUFFER_EXT,renderbuffer[4]
glTexImage2D GL_TEXTURE_CUBE_MAP_POSITIVE_Z,0,GL_RGB,width,heig ht,0,GL_RGB,GL_UNSIGNED_BYTE,Null
glFramebufferTexture2DEXT GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEX TURE_CUBE_MAP_POSITIVE_Z,glTexture,0

glBindFramebufferEXT GL_FRAMEBUFFER_EXT,framebuffer[5]
glBindRenderbufferEXT GL_RENDERBUFFER_EXT,renderbuffer[5]
glRenderbufferStorageEXT GL_RENDERBUFFER_EXT,GL_DEPTH_COMPONENT,width,heigh t
glFramebufferRenderbufferEXT GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_REND ERBUFFER_EXT,renderbuffer[5]
glTexImage2D GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,0,GL_RGB,width,heig ht,0,GL_RGB,GL_UNSIGNED_BYTE,Null
glFramebufferTexture2DEXT GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEX TURE_CUBE_MAP_NEGATIVE_Z,glTexture,0

'glBindTexture GL_TEXTURE_CUBE_MAP,0
gldisable GL_TEXTURE_CUBE_MAP

EndIfThe user's machine crashes right before the first call is made to glFramebufferTexture2DEXT(). The line it crashes on is this:

glFramebufferTexture2DEXT GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEX TURE_CUBE_MAP_POSITIVE_X,glTexture,0Any ideas what the problem could be?

bobvodka
01-02-2007, 05:24 PM
a while back I found that for some reason if you attached a depth buffer then the colour buffer it would crash on certain driver revisions.

Reversing the attachment order fixed it, I'm guessing it's a driver bug (although I've not tested it on recent drivers) as I never used to have this problem.

Cat 6.9 were effected iirc