Sign in to follow this  
zaneski13

Get pixel info from texture in GLSL [SOLVED]

Recommended Posts

So I'm implementing deferred shading in my app and I need to access pixel information directly from a texture. So if I had to get the pixel information from a texture at (46,78) how would I get that specific color data? [Edited by - zaneski13 on February 16, 2010 10:56:45 PM]

Share this post


Link to post
Share on other sites
You would have to use texture coordinates instead of pixel coordinates with texture2D function. eg you have to devide (46,78) by width and height of your image.
http://www.lighthouse3d.com/opengl/glsl/index.php?texture

Share this post


Link to post
Share on other sites
There are some GLSL functions added I think for 1.40 or 1.50 for sampling a texture with pixel coordinates. I think they start with texture2DFetch or something like that. Check the spec.
Of course, it is only for DX10 level GPUs.

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