• Advertisement
Sign in to follow this  

Get pixel info from texture in GLSL [SOLVED]

This topic is 2927 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Thanks Guys!
http://www.lighthouse3d.com/opengl/glsl/index.php?texture Excellent source, I learned a lot today

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement