Posted 21 November 2011 - 06:09 AM
It probably depends on the GPU's capabilities. Perhaps the next generation will have bit manipulation capabilities. Desktop GPUs already have it.
Yeah I'm stuck on GLSL 1.20 at the moment. I ended up using a bool for each option.
There is nothing wrong with using bool and if and else, unless if it gives performance problems on your target GPU. Personally, I would have multiple shader versions.
Sig:
http://glhlib.sourceforge.netan open source GLU replacement library. Much more modern than GLU.float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);