PDA

View Full Version : Problem with Framebuffer



brendan8
05-04-2014, 07:39 AM
Hey all,

I am trying to take the attach the output of one shader to an opengl texture I created, then pass it to another shader. I have this code:



glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, appctx.terrain->tex1, 0);

GLenum DrawBuffers[1] = { GL_COLOR_ATTACHMENT0 };
glDrawBuffers(1, DrawBuffers);


after this I switch framebuffers and load up the second shader. My question is: does this code bind the output data to appctx.terrain->tex1, and if I switch framebuffers, assuming all other code is correct, when I switch framebuffers, if I pass this texture in to the second shader, will it have the output data from the first shader in it?

It isn't working for me so I need to know if the problem is here or elsewhere. Thanks

debonair
05-05-2014, 01:32 AM
can you post your code?

you need to bind the texture when you are drawing to that texture.