View Full Version : matrix from gl to glsl
05-11-2004, 12:05 AM
.. i'm using gl_TextureMatrix to catch a matrix from gl .. its working pretty well, but the index correnponds on the bound texture .. thats sucks .. any ideas ???
05-11-2004, 12:59 AM
ok .. i'm using gl_modelviewmatrix .. a little bit stupid .. but it works ..
05-11-2004, 01:46 AM
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) :
mat4 gl_ModelViewMatrix mat4 gl_ModelViewMatrix mat4 gl_ProjectionMatrix mat4 gl_ModelViewProjectionMatrix mat3 gl_NormalMatrix mat4 gl_TextureMatrix[gl_MaxTextureCoordsARB]
P.S. : Why is using gl_ModelViewMatrix stupid?
05-11-2004, 04:05 AM
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 ..
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 ..
05-11-2004, 08:46 AM
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 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.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.