gl_ModelViewMatrixInverse

Hi everyone,

I’m currently developing some water rendering where I need to transform eye space coordinates to world space coodinates.

My dev. platform is a GeForce FX, and I happily use the ‘gl_ModelViewMatrixInverse’ variable to do the maths.

I just tested on a ATI Radeon 9700 (Cat. 4.8) system, and the GLSL compiler spits at me that it doen’t know ‘gl_ModelViewMatrixInverse’ !!

Does anyone know exactly which parts of GLSL ATI supports ?

Thanks,

Nicolas.

Maybe the 4.8 drivers didn’t implement the version of the GLSL spec which added the inverse matrices. Try updating your drivers.

Yep, since my 1st post, I also tried the Cat. 4.9 without luck either…

Hmmm, I think I’ll be off to make another NV/ATI branch in my code…

gl_ModelViewMatrixInverse is defined in GLSL version 1.1. AFAIK there is no GLSL 1.1 implementation right now, not from ATI nor from nVidia. Maybe 3DLabs supports it.

If you don’t want to make different branches in your code for implementations that don’t support this yet, just invert the matrix yourself and pass as a uniform.

Originally posted by Corrail:
gl_ModelViewMatrixInverse is defined in GLSL version 1.1. AFAIK there is no GLSL 1.1 implementation right now, not from ATI nor from nVidia. Maybe 3DLabs supports it.
ahh that explains why a few of the inverse/tranpose thingees weren’t recognized, though gl_ModelViewMatrixInverse does work (66.00 nvidia drivers) i use it to get the camera position

vec4 camera_pos = gl_ModelViewMatrixInverse[3];

gotta admit ive been having a few troubles though by passing in mat4 as uniforms with the 66.00 drivers
eg
Vertex info

Internal error: assembly compile error for vertex shader at offset 0:
– error message –
line 1, column 1: error: invalid vertex program header

unifrom mat4 objectspace;

main()
{	vec4 obj_vert = vec4( gl_Vertex.xyz, 1.0 ) + vec4( gl_MultiTexCoord3.xyz, 0.0 ) * gl_Color.a;	

	vec4 mv_vert = gl_ModelViewMatrix * objectspace * obj_vert;

gl_Position		= gl_ModelViewProjectionMatrix * objectspace * obj_vert;
}

remove either of the objectspace’s though + it works!

Try to write uniform correctly. :wink:
For better performance: instead of two matrix * matrix multiplications do this:

vec4 vTemp = objectspace * obj_vert;
vec4 mv_vert = gl_ModelViewMatrix * vTemp;
gl_Position = gl_ModelViewProjectionMatrix * vTemp;

Originally posted by Corrail:
gl_ModelViewMatrixInverse is defined in GLSL version 1.1. AFAIK there is no GLSL 1.1 implementation right now, not from ATI nor from nVidia. Maybe 3DLabs supports it.
I can confirm that, 3DLabs cards (at least Realizm) has version 110 of GLSL (that means that has xxInverse and xxxInverseTranspose matrices (and all other 110 stuff))

Ahf thanks for the infos, I should read specs more carefully !

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