What is texture swizzling?

Hello

I need to understand what is texture swizzling and what can be achieved by this feature?
What should happen when we pass the token TEXTURE_SWIZZLE_R to TexParameteriv ?

It would be good if I could get some sample code for reference. I have already referred to http://www.opengl.org/registry/specs/ARB/texture_swizzle.txt.

Thanks in advance.

This thing went into GL 3.3

Swizzling means remapping.
For example, you can swap the red and green component.
Or, you can swap the red and green component and have blue and alpha set to 1.


glBindTexture(target, id);
glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_GREEN);
glTexParameteri(target, GL_TEXTURE_SWIZZLE_G, GL_RED);
glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_ONE);
glTexParameteri(target, GL_TEXTURE_SWIZZLE_A, GL_ONE);

Also, read the part about “2) What is the demand for this extension?”

Did you check the wiki?

Thanks.
That was great help.