Sign in to follow this  
Mekanikles

Need help with "Postprocessing" in OGL

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

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