hwj_just

03-30-2005, 01:28 AM

What is the Matrix stack in opengl?How do they work, and are they all 4*4?

Can you give me some introduce about matrix stack?Thank you !

Can you give me some introduce about matrix stack?Thank you !

View Full Version : Matrix stack

hwj_just

03-30-2005, 01:28 AM

What is the Matrix stack in opengl?How do they work, and are they all 4*4?

Can you give me some introduce about matrix stack?Thank you !

Can you give me some introduce about matrix stack?Thank you !

mikael_aronsson

03-30-2005, 02:40 AM

Hi !

Yes they are all 4*4, a matrix stack is just that, a stack of matrices, you can push and pop a matrix from the top of the stack, glPushMatrix() will save the current matrix so that you can mess around with it any way you want (glTranslate, glRotate, glScale and so on), and when you are done with your transformations you can use glPopMatrix() to restore the matrix to what it was before the glPushMatrix(), this is for example used to do hierarchical transformations.

Have a look at the OpenGL spec at this website for more information.

Mikael

Yes they are all 4*4, a matrix stack is just that, a stack of matrices, you can push and pop a matrix from the top of the stack, glPushMatrix() will save the current matrix so that you can mess around with it any way you want (glTranslate, glRotate, glScale and so on), and when you are done with your transformations you can use glPopMatrix() to restore the matrix to what it was before the glPushMatrix(), this is for example used to do hierarchical transformations.

Have a look at the OpenGL spec at this website for more information.

Mikael

jide

03-30-2005, 02:44 AM

Originally posted by hwj_just:

What is the Matrix stack in opengl?How do they work, and are they all 4*4?

Can you give me some introduce about matrix stack?Thank you !Matrix stack as its name says is a stack containing matrices. Each time you push a matrix it is added on the top of the stack and each time you pop the top matrix is removed. You do that generally to perform some complex transformations hard to explain with simple mathematics functions, just like if I rotate of alpha around the z axis, then if I consider this is my new basis, what is the expression of this new basis regarding the origin. With maths, and as far as I know only matrices can do that.

Matrix statck isn't 4*4, but all GL matrices are 4*4. This is just because all geometric transformation can be done with a matrix 4*4 representation. If you want more info about that maybe the maths & algo forum can help you. Or you can google or you can read books...

With GL, you use matrices when you work with modelisation/visualisation, projection and with textures. I don't have in mind any other situations where you use them. Default is the identity matrix that geometrically represents the origin, so all operations will happen at this basis.

Hope this helps.

What is the Matrix stack in opengl?How do they work, and are they all 4*4?

Can you give me some introduce about matrix stack?Thank you !Matrix stack as its name says is a stack containing matrices. Each time you push a matrix it is added on the top of the stack and each time you pop the top matrix is removed. You do that generally to perform some complex transformations hard to explain with simple mathematics functions, just like if I rotate of alpha around the z axis, then if I consider this is my new basis, what is the expression of this new basis regarding the origin. With maths, and as far as I know only matrices can do that.

Matrix statck isn't 4*4, but all GL matrices are 4*4. This is just because all geometric transformation can be done with a matrix 4*4 representation. If you want more info about that maybe the maths & algo forum can help you. Or you can google or you can read books...

With GL, you use matrices when you work with modelisation/visualisation, projection and with textures. I don't have in mind any other situations where you use them. Default is the identity matrix that geometrically represents the origin, so all operations will happen at this basis.

Hope this helps.

Vinícius Reis

03-30-2005, 08:10 AM

If you've studded liner algebra, you know that not all transformations are linear, for example translation. Why is it so important to a transformation to be linear? It’s important in order to represent them in the form of matrices. So there was developed another kind of geometry that, in Portuguese, is called “geometria afim”. I don’t know the name is English or French. In a plane, if you have a direction (vector) it’s represented by (x,y,0), and if you have a point it’s represented by (x,y,1). So there’s some operation that were defined between points and vector, and so on…

In the case of 3 dimensions, if you have the following point (x1,x2,x3,1) you can translate it by multiplying for the matrix

1 0 0 -x

0 1 0 -y

0 0 1 -z

0 0 0 1

There is a good book that explains a little about the mathematical basis of computer graphics. If you know portuguese: “Fundamentos da Computação Gráfica - IMPA, 2003”

In the case of 3 dimensions, if you have the following point (x1,x2,x3,1) you can translate it by multiplying for the matrix

1 0 0 -x

0 1 0 -y

0 0 1 -z

0 0 0 1

There is a good book that explains a little about the mathematical basis of computer graphics. If you know portuguese: “Fundamentos da Computação Gráfica - IMPA, 2003”

Vinícius Reis

03-30-2005, 08:16 AM

I've just found out!

"Affine Geometry"

"Affine Geometry"

Aeluned

03-30-2005, 10:14 AM

Affine transformations.

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.