PDA

View Full Version : Can the matrix be changed in the middle of a draw?



MrUNOwen
10-24-2011, 05:21 PM
Hello,

So I recently tried modify view matrix in between a glBegin and glEnd() with no luck. Is there a mode I have to be in for this to work, or is it just not possible? If it's just a matter of enabling something, what draw backs are there to enabling it?

Alfonse Reinheart
10-24-2011, 05:40 PM
It's not possible.

MrUNOwen
10-24-2011, 05:54 PM
So in cases where you have one whole model, but you want to bend one joint, what's the standard practice for that? Is it all just done on the application layer?

Alfonse Reinheart
10-24-2011, 06:28 PM
Traditionally, they just did the transforms on the CPU. In modern days, you use a shader. Each vertex is tagged with which matrices it uses and how much to weigh each one. And you just pass all the matrices that you need to the shader.

Dark Photon
10-25-2011, 06:28 AM
Can the matrix be changed in the middle of a draw? ... Is there a mode I have to be in for this to work, or is it just not possible?
To extend what Alfonse said, there are a number of ways nowadays you can effectively change/augment the MODELVIEW transform in the middle of a draw call, but you need to use shaders to do it.

You can pass in matricies/transforms/quaternions/whatever as vertex attributes and use them in the shader to augment MODELVIEW. And/or you can pass in bone indices via vtx attribs, and use them to index into other things, a uniform arrays of matrices/quats/etc. or a texture (buffer, 2D, etc.) containing matrices/quads/etc.