Matrix from gl to glsl

… i’m using gl_TextureMatrix[0] to catch a matrix from gl … its working pretty well, but the index correnponds on the bound texture … thats sucks … any ideas ???

ok … i’m using gl_modelviewmatrix … a little bit stupid … but it works …

Is it so hard to take a look at the glsl-specs? There are plenty of matrices predefined (although there could be some more like in ARB_VP/ARB_FP) :
[ul][li]mat4 gl_ModelViewMatrix []mat4 gl_ModelViewMatrix[]mat4 gl_ProjectionMatrix[]mat4 gl_ModelViewProjectionMatrix[]mat3 gl_NormalMatrix[*]mat4 gl_TextureMatrix[gl_MaxTextureCoordsARB][/ul][/li]P.S. : Why is using gl_ModelViewMatrix stupid?

because i’m using a two pass shader and need the matrix in both passes. when i’m using the modelMatrix i have to pop after my first pass for drawing my scenen … if i could store in textureMatrix and haven’t this problems … but i’m not sure, how i can maniuplate the index of gl_TextureMatrix[0] …

is the index equal to the bound name of the bound texture ??

… to write to the textureMatrix i’m just calling glMatrixMode(GL_TEXTURE); how do i know the right index for gl_TextureMatrix[] and gl_MultiTexCoord0 in my shader?? oi read a lot about textures in the read, orange and blue book, but i didn’t found the answer …

textures in GLSL dont refer to ‘texture objects’ but ‘texture units’, so if you bind a texture object to texture unit 0 and change its matrix then gl_TextureMatrix[0] refers to the matrix of that texture unit
You know what texture it refers to because you bound the texture to that texture unit before calling the shader.

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