GLSL Post-processing system

Put the farm game on the shelf for a while because uni’s back.

I spent all weekend making a easy to use post processing system for OpenGL. Basically, I am drawing my entire scene to a FBO, then drawing a fullscreen quad with the FBO as the texture to a different FBO. Then I draw that FBO as a full screen quad to another FBO, rinse and repeat until all effects have been applied. The system uses a list of effects which means you can stack shaders to combine effects.

Usage:

//Setup code
PostProcessor pp( screenW, screenH );
Shader* shader1 = new Shader();
shader1->loadVertexShader(   "file.vert" );
shader1->loadFragmentShader( "file.frag" );
shader1->compileShader();
pp.addEffect( shader1 );

//Main game loop
pp->stopRendering();
	//All scene rendering code to go here
pp->stopRendering();
//Draw the final screen
pp->drawProcessedScreen();

Easy as!

Here are some screenshots of various shaders:

Advertisement

~ by weetbix on August 17, 2009.

One Response to “GLSL Post-processing system”

  1. Looks nice! Where can i find the code?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.