PDA

View Full Version : 3d render texture



Jay2
07-18-2005, 08:45 AM
Have anyone succeded with glFramebufferTexture3DEXT? My code generates GL_FRAMEBUFFER_UNSUPPORTED_EXT on GeForce 6800 Ultra. The 3D texture type is float RGB.

glGenTextures(1, &tex_accum3d);
glBindTexture(GL_TEXTURE_3D, tex_accum3d);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
float * data = new float[vol_width*vol_height*vol_depth*3];
memset(data,0,vol_width*vol_height*vol_depth*3*siz eof(float));
ext_im.glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB_FLOAT32_ATI, vol_width, vol_height, vol_depth, 0, GL_RGB, GL_FLOAT, NULL);
delete [] data;

// attach fbo texture to the color0
ext_fbo.glFramebufferTexture3DEXT(GL_FRAMEBUFFER_E XT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_3D, tex_accum3d, 0,0);

ext_fbo.glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depth_rb);
ext_fbo.glRenderbufferStorageEXT(GL_RENDERBUFFER_E XT, GL_DEPTH_COMPONENT24, vol_width, vol_height);

// attach the renderbuffer to depth
ext_fbo.glFramebufferRenderbufferEXT(GL_FRAMEBUFFE R_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_rb);

CheckFramebufferStatus();