How to make this code work on Mesa3d?

1.4k views Asked by At

This GLSL code compile and run warningless in ATI's OpenGL:

void main()
{
  vec4 tmp = gl_ModelViewMatrix * gl_Vertex;
  tmp.xyz = tmp.xyz / (1 - tmp.w);
  tmp.w = 1;
  gl_Position = gl_ProjectionMatrix * tmp;
  gl_FrontColor = gl_Color;
}

Why does it fail with mesa? How to decrypt that error message and make it Mesa's implementation compliant?

Compilation log:
0:1(88): error: Could not implicitly convert operands to arithmetic operator
0:1(89): error: Operands to arithmetic operators must be numeric
0:1(97): error: type mismatch
1

There are 1 answers

0
genpfault On BEST ANSWER

Try changing your 1s to 1.0s.