lizardq

GLSL mat3 contructor fails (produces wrong result)

Discussion created by lizardq on Jun 24, 2010
Latest reply on Jun 28, 2010 by frali

The mat3 contructor fails (produces a wrong matrix) inside the fragment shader if passed a variable argument at particular positions. See following code...


mat3 pitchMat( const float angle )
{
    float s = sin( angle ), c = cos( angle );

// does not work:
// return mat3(1, 0, 0, 0, c, -s, 0, s, c );

// workaround:
    mat3 m = mat3( 1, 0, 0, 0, 1, 0, 0, 0, 1 );
    m[1][1] = c; m[2][2] = c; m[1][2] = -s; m[2][1] = s;
    return m;

// interstingly, this works:
// return mat3( c, 0, -s, 0, 1, 0, s, 0, c );
}


Catalyst 10.5 on a Mobility Radeon HD 4350 inside an HP notebook.

(I've been pointed to this forum by AMD tech support with the following "explanation": AMD Customer Care does not currently offer support or troubleshooting in OpenGL development software. ?!?)

Outcomes