Texture sampling default return value specification (GLSL 4.6)

Hello Everyone,

How is the default return value of the texture function family defined?

the texture functions are specified to return always gvec4. But what happens if you sample e.g. a RG texture?
Are the b and a components than undefined or have they a default value?
On my machine the b component is always 0 and the a component is always 1 for a RG32F texture. But that doesn’t proof anything.

I searched the whole specifcation of GLSL 4.6 but didn’t find anything. But maybe i missed something:

Greetings
Neconspictor

It’s not in the GLSL specification. Just like the rules for other aspects of texture sampling (filtering, texture coordinate wrapping, etc), it’s in the OpenGL specification.

And yes, the remaining coordinates will be filled out with (0, 0, 0, 1) in RGBA order. Well, this is the default value; the texture’s swizzle mask can change this.

1 Like

Thank you! Now everything is clear to me :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.