Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!

Render on targets starting from an already rendered one

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 jjtulip   Members   -  Reputation: 166


Posted 12 June 2014 - 08:44 AM

Sorry, soved this. Mod I ask you to delete the topic if possible as is useless now, was indeed a stupid thing.

Edited by jjtulip, 12 June 2014 - 10:07 AM.


#2 L. Spiro   Crossbones+   -  Reputation: 14447


Posted 12 June 2014 - 03:03 PM

Do not edit your questions out and replace them with an “I solved this”.
Post your question and then your solution so that others with the same problem (even if it is stupid) may be able to find the answers as well.

Hi all!
I have to perform a double pass convolution on a texture that is actually the color attachment of another render target, and store it in the color attachment of ANOTHER render target. This must be done multiple time, but using the same texture as starting point

What I do now is (a bit abstracted, but what I have abstract is guaranteed to work singularly)

	renderOnRT(firstTarget); // This is working. 

	for each other RT currRT{
		glBindFramebuffer(GL_FRAMEBUFFER, currRT.frameBufferID);	
		glBindTexture(GL_TEXTURE_2D, firstTarget.colorAttachmentID);
		glBindTexture(GL_TEXTURE_2D, firstTarget.depthAttachmentID);
		glBindBuffer(GL_ARRAY_BUFFER, quadBuffID); // quadBuffID is a VBO for a screen aligned quad. It is fine.
		programX.vertexAttribPointer(POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);

		glBindTexture(GL_TEXTURE_2D, currRT.colorAttachmentID); // The second pass is done on the previous pass
		glBindTexture(GL_TEXTURE_2D, currRT.depthAttachmentID);
		glBindBuffer(GL_ARRAY_BUFFER, quadBuffID);
		programY.vertexAttribPointer(POSITION_ATTRIBUTE, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
		glDrawArrays(GL_QUADS, 0, 4);

The problem is that I end up with black textures and not the wanted result. If I render them on screen with a simple passthrough with a screen-aligned quad the result is all but black.

The GLSL programs program(X,Y) works fine, already tested on single targets.

Is there something stupid I am missing? I'm bashing my head on this code since yesterday morning with no luck...

Any hint is much appreciated smile.png Thank you!

Feel free to post your solution.
L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.