Sign in to follow this  
judge dreadz

FBOs and glDrawBuffers

Recommended Posts

judge dreadz    193
copied from another forum because i need some help urgently and havent received any replies. i am using FBOs to render to texture from Cg fragment shaders: i have a strange bug in my code. i set my render targets and perform a computation like this: // set render destination GLenum drawBuffers[] = { attachPosition[WRITE], attachVelocity[WRITE] }; glDrawBuffers(2, drawBuffers); //perform computation drawQuad(); i then bind a different fragment shader and perform a different computation: // set render destination glDrawBuffer(attachSort[WRITE]); drawQuad(); the results of the second computation are being written to my position and velocity textures. so the call do glDrawBuffer before the second computation isnt working. i dont know why, i can only think that maybe my sort textures are not attached to the FBO properly. is there a way to query if my glDrawBuffer call was succesful? or to query that my sort textures are attached ok? i have 6 color attachments on my FBO, is that too many? this is how i set up my FBO: GLenum attachPosition[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT }; GLenum attachVelocity[] = { GL_COLOR_ATTACHMENT2_EXT, GL_COLOR_ATTACHMENT3_EXT }; GLenum attachSort[] = { GL_COLOR_ATTACHMENT4_EXT, GL_COLOR_ATTACHMENT5_EXT }; glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachPosition[READ], TEX_TARGET, pos[READ], 0); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachPosition[WRITE], TEX_TARGET, pos[WRITE], 0); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachVelocity[READ], TEX_TARGET, vel[READ], 0); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachVelocity[WRITE], TEX_TARGET, vel[WRITE], 0); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachSort[READ], TEX_TARGET, sort[READ], 0); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachSort[WRITE], TEX_TARGET, sort[WRITE],0); // check status if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) printf("ERROR - Incomplete FrameBuffer\n"); i dont get any error, but i cant understand where the bug is. have been trying to fix it for 2 days now! any help/suggestions greatly appreciated as always, thanks.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this