Get pixel info from texture in GLSL [SOLVED]
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]
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
http://www.lighthouse3d.com/opengl/glsl/index.php?texture
There's also texelFetch that takes integer coordinates, if you're using GLSL 1.3 or later.
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.
Of course, it is only for DX10 level GPUs.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement