Sign in to follow this  
Mekanikles

OpenGL Need help with offscreen buffers

Recommended Posts

Hi, tis' me first post on this lovely site and I'm a bit of a newbie so please bare with me. I'm making an old-school-gradius-style 2D shootemup in C++ using OpenGL and GLFW. My problem is that I want to use Postprocessing effects to create some nice picture distortions (water for example). What I'd really like to do is render the whole screen on to a 320x240 offscreen buffer and then use that to draw the screenbuffer. Also it would be nice if it were platform independent. I'd like to know if there's a good way to do this. Now, i didn't come rushing here at the first sight of trouble so, I did try solve this problem myself. So, I tried just copying my whole rendered scene to an ordninary texture(512*256) and then back on screen. This works fine when in native resolution but if I want to enlarge the window to, say 640x480, I'll have to make a larger texture (1024*512) and copy a larger portion of the screen on to it. It feels like a waste of resources to copy a section 4 times the size of the one I need when all I want is to have a larger window. My next try was to always set my viewport to native resolution before the render loop (no matter my window size), store the finished scene on a texture, do the postprocessing, restore the viewport and then draw the buffer to fit the window. This works pretty well but is slow and if for some reason, my window happens to be smaller than native res I can't render the scene properly. Using shaders have occured to me, but having never dealt with them I harldy know what they do and if they can be of any help at all. As you might have noticed, I'm a tad stumped over this and would be truly grateful for any help I can get. Thanks in advance! /Mekanikles (sorry for repost, this was in Beginners forum so I moved it)

Share this post


Link to post
Share on other sites
Wow, thanks!, it really looks like just what I need

But, and I feel i might need to crawl back to beginner's section here, what exactly is an OGL Extension and how do you use it? (yes, i tried looking for the answer but either I'm retarded or my question is ^^)

I googled around abit on the extension you mentioned and found some source code for msvc but i couldn't compile it.
I got a lot of errors like:
"error C2501: 'glFramebufferTexture1DEXT' : missing storage-class or type specifiers"

I don't know what to include/link and would be even more grateful for som further advise :)

[Edited by - Mekanikles on June 9, 2006 4:46:49 PM]

Share this post


Link to post
Share on other sites
Read this article to learn about extensions and how to use them. After you read that, I recommend not doing all the extension loading manually and just use an extension loading library such as GLee or GLEW.

Share this post


Link to post
Share on other sites
I will look into it right away, though I have just made the decision to stick to strictly old-school graphics (think Cave Story), I will most certainly use extensions like these in my upcoming project.
Thanks for taking your time.

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