Matrix multiplication without effect

Hello,

I am doing a texture coordinate calculation in my vertex shader for a projective lighting. Therefore I need to multiply the gl_ModelViewMatrix with my lightViewingMatrix, but no matter which values this matrix contains, it doesn’t change my results.
I hope anybody can help me…

here is what i’m doing:

  
"varying vec4 projPos;"//projected light-texture coord
"void main(void)"
"{"
// light projection matrix
"   mat4 lightProjMat= (0.68,0.0,0.0,0.0,    "
"                       0.0,2.85,0.0,0.0,    "
"                       0.0,0.0,-0.04,0.0,   "
"                       0.0,0.0,-1.04,1.0);  "
   //light ViewTransformation Matrix:
"   mat4 lightViewMat= (1.0,0.0,0.0,0.0,     "//column 1: x-axis light-CS
"                       0.0,1.0,0.0,0.0,     "//column 2: y-axis light-CS
"                       0.0,0.0,1.0,0.0,     "//column 3: z-axis light-CS
"                       8.35,-1.48,-0.5,1.0);"//column 4: translation light
// Scale and translate
"   mat4 scaleTranslMat= (0.5,0.0,0.0,0.0,   "
"                         0.0,0.5,0.0,0.0,   "
"                         0.0,0.0,0.5,0.0,   "
"                         0.5,0.5,0.5,1.0);  "
"  projPos = scaleTranslMat * lightProjMat * lightViewMat * gl_ModelViewMatrix * gl_Vertex;"
"  gl_TexCoord[0]  = gl_MultiTexCoord0;"
"  gl_Position = ftransform();"
"}"

the problem is, that none of my matrices takes effect :frowning:

Can anyone tell me what’s wrong here? I think it’s a general problem, because as I mentioned it doesn’t matter what the matrices contain…

thanks
Simon

i believe u need to do mat4 fdf = mat4(…)
ie use a constructor, though this error should show up in the compiler

What does your fragment shader look like?

indeed, the mat(…) has really been the problem, thank you zed…
(my fragment shader only does a texture lookup with the coordinate projPos)

Wouldn’t it be better to put something like in the global context and declare it as const mat4 … or it doesn’t matter?

yes, I think that would be better, but I only coded this as a test…

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