Jump to content
  • Advertisement
Sign in to follow this  
ic0de

OpenGL Multipass shaders in GL 2.0

This topic is 2525 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

I'm running three shaders in my OpenGL program and they all require the their input texture to be the output of the previous texture. As far as I know FBO's can accomplish this. However I cannot use FBO's for this as they were introduced in GL 3.0 and my program must support at least GL 2.0. I am currently using glCopyTexImage2D() for copying the screen into a texture, any chance that it can also be used for multipass rendering, if not how can this be accomplished in GL 2.0?

Share this post


Link to post
Share on other sites
Advertisement

FBO is available since 1.1
http://oss.sgi.com/p...ffer_object.txt

Are you talking about FBO color attachments?
Read this:
http://www.songho.ca...ngl/gl_fbo.html

Oh I almost forget You will need 2 FBOs because you cannot render into binded FBO


No, it is not available since GL 1.1
FBO was created as an extension during the GL 2.0 period. Keep in mind that there is a difference between an extension and a GL version.
For example, certain Intel drivers have GL 2.0 but don't have the FBO extension.

You can find examples for GL_EXT_framebuffer_object
here
http://www.opengl.or...mebuffer_object

Share this post


Link to post
Share on other sites
I'm having some trouble with [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

GL_EXT_framebuffer_object

[/font]
[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

I'm initializing my fbo like this:

[/font]


glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, screen->format->BytesPerPixel, screen->w, screen->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glGenRenderbuffersEXT(1, &rbo);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rbo);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, screen->w, screen->h);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
glGenFramebuffersEXT(1, &fbo);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fbo);
glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture, 0);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rbo);


I bind it like this:

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);


then I draw my scene

and then apply shaders to it and then I render it to a full screen quad like so:

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glBindTexture(GL_TEXTURE_2D, texture);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glBindBuffer(GL_ARRAY_BUFFER, Vbuffer);
glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(float), screenvertices, GL_STATIC_DRAW);
glVertexPointer(2, GL_FLOAT, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, Tbuffer);
glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(float), ltexcoords, GL_STATIC_DRAW);
glTexCoordPointer(2, GL_FLOAT, 0, 0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);


However nothing draws at the moment
why?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!