Jump to content
  • Advertisement
Sign in to follow this  
judge dreadz

FBOs and glDrawBuffers

This topic is 4555 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!