Passing gl_MultiTexCoords as variables.

Started by
2 comments, last by _the_phantom_ 18 years, 10 months ago
I would like to know how to send UVs to an specific variable that can be used in a shader. The case I have is the following: I have two kinds of UVs: the UVSlot1 and UVSlot2. Now I want to specify for the shaders the following ShaderSlot1, ShaderSlot2, and so on. That means that there is one ShaderSlot per sampler. Now suppose I have 4 textures, I want to be able to specify for example ShaderSlot1 has the info of UVSlot2, ShaderSlot2 has the info of UVSlot1, ShaderSlot3 has the info of UVSlot1 , and ShaderSlot4 has the info of UVSlot2 all that without ever changing the shader. The shader just says, for Texture1 use ShaderSlot1, for Texture2 use ShaderSlot2, and so on. So how can I pass the gl_MultiTexCoords I specified with glTexCoordPointer to an specific variable. BTW, I want to avoid sending info using attributes if possible, I just want to link ShaderSlot(n) to UVSlot(n). Thanks.
Advertisement
im not really understnading what youre saying
do u believe that u have to use
texturematrix0 texturecoords only on texture0
texturematrix1 texturecoords only on texture1
texturematrix2 texturecoords only on texture2
if so youre mistaken u can mix them up anyway u want
No, what I'm saying is that just because I can use any texture matrix on any texture, I want to make a system where I can specify any texture matrix (which already has the data and has already been uploaded to the video card) on a texture in the shader.

So I create a seperate file that maps "mytexmatrix1" to "texturematrix3" if I want to all without ever touching the shader.
hold on, you've gone from texture coords to texture matrix here... i'm a tad confused [smile]

the built in gl_MultiTexCoords varibles are set by assiging UV values to the texture unit of the same number.
If you want a more generalised system then you will need to use the generic attributes system to apply certain values to certain internal shader values and then perform the look up the texture sampler which is bound to the texture unit with the texture bound to it you wish to associate that type with.

Texture matrix's always stick with their texture units, however a sampler can have different texture units bound to it as and when you like

This topic is closed to new replies.

Advertisement