Jump to content
  • Advertisement
Sign in to follow this  
Hulag

Passing gl_MultiTexCoords as variables.

This topic is 4779 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!