PDA

View Full Version : Tetture matrix defaults?



Ketracel White
01-06-2011, 02:43 PM
I'm having the following problem:

One shader I wrote uses texture matrix 7. When I start my program the matrix is not initialized.

Running my program on a Geforce I get the expected behavior of the matrix being initialized to the identity matrix.

However, when I start the same program on an ATI card nothing gets rendered, as if the matrix defaults to 0.

Which one is correct according to GL specs?

Alfonse Reinheart
01-06-2011, 03:16 PM
I'm pretty sure matrices are initialized to identity. However, have you considered that texture matrix 7 may not be supported on the hardware in question? You only have as many texture matrices as GL_MAX_TEXTURE_UNITS, and the minimum for that is 2.

I'm rather surprised that what you did works on NVIDIA hardware, since they only support 4 fixed-function texture units.

Ketracel White
01-06-2011, 04:00 PM
The hardware in question are ATI HD 5770 and HD 4850 so it's recent models. It doesn't matter which texture matrix I use here, they all produce the same glitch.

Also, why should the number of fixed function texture units have any effect on shaders?

Alfonse Reinheart
01-06-2011, 04:06 PM
Also, why should the number of fixed function texture units have any effect on shaders?

That's where texture matrices come from. You set glMatrixMode(GL_TEXTURE), and that's the texture matrix for that texture unit. The fact that GLSL can access this matrix doesn't change the fact that it is a fixed-function parameter.

I checked the specs, and it turns out that the number of texture matrices is based on the number of texture coordinates, not texture units. Which has a minimum of 8.