Sign in to follow this  
Sigvatr

Simple GLSL scanline effect

Recommended Posts

Sigvatr    203
I'm trying to figure out how to make a simple GLSL shader that passes a filter over the entire screen. I already have a buffer object that I display in its entirety onto the screen, but I'm holding it in that buffer at the moment so I can pass the shader effects on it. Anyone have an idea on how to make a quick scanline effect? Basically, every 2nd row of pixels gets darkened slightly. Cheers.

Share this post


Link to post
Share on other sites
Have you tried using texture mapping coordinates?
As you have stated you already have a buffer object displayed. Now you can map this object on quad aligned with display area. In fragment shader you can access mapping coordinates of appropriate texel. These coordinates are in range [0,1] so y (t) coordinate could be multiplied by fragment color to produce darkening effect. This also should be as fast as simple drawing with texture.

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