View Full Version : getting texture dimensions from inside a shader

09-25-2013, 08:19 AM

I would like to get texture's width height and depth from within the shader. Is that possible? I read some previous posts on how there is no way to do this except sending the dimension values as uniform variables into the shader. Is this still the case?

I have code where the texture is bound to a texture unit in a different location and then the shader's sampler is attached to the texture unit (all the shader binding etc in a different location). I would like to keep all things together instead of decoupling properties of a texture in different variables, samplers etc in different locations and then loosing track of these and messing up.


09-25-2013, 11:06 AM
Look here: http://www.opengl.org/sdk/docs/manglsl/xhtml/textureSize.xml