Skip to main content
gamedev.net
🔒 Locked

access model view matrix??

Started by Lennings Oct 10, 2006 at 2:44 AM 1 replies 800+ views
Original Post
Lennings
Lennings
Hi. I wonder if I can access the model view like any array. Like modelview[12] = x; modelview[13] = y; modelview[14] = z; Or do I need to get model view matrix set the 12, 13 and 14 and then load the matrix. Or to glMultiNatriz with an identity metrix with 12, 13, and 14 set to at different value. Thanks for all the help.
haegarr
haegarr
OpenGL doesn't grant you access to the memory of its internal matrix stacks. You can alter the stacks indirectly with the transformation routines, and you can ask for a copy of the current matrices. So, if you alter any matrix by indexed access it must be a matrix owned by yourself and OpenGL isn't concerned (until you use the matrix as argument to a OpenGL routine, in which case OpenGL makes a copy).

You can, of course, set the translation by hand into a matrix (as you can assemble any other senseful matrix by hand). Just consider two rules: (1) Guarantee that all 16 scalars are validly set (e.g., as you've suggested, initialize the matrix as an identity matrix before setting the translation), and (2) take into account that matrix multiplication isn't commutative. Else the results on screen will not be what you expected.

Whether the matrix plays the role of a projection, view transformation, or model transformation (or something else) doesn't matter in this sense. But you have to consider that assembling view matrices from a camera is the inverse process of assembling model matrices. Always look first on the total mathematical process before applying any optimization.

[Edited by - haegarr on October 10, 2006 3:05:34 AM]
Lennings
Lennings
Okay.

that help a lot, in some places in the code. :-)

Thants.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.