View Full Version : Keeping track of vertices??

MaNDROiD

11-25-2004, 10:05 PM

Hi, I was just wondering if there is a way for you to keep track of the values of the vertices as they go through the transformations like glRotate*(), glScale*(), glTranslate*()... for example, if i said glVertex3f(x,y,z)...and then subject that vertex through a bunch of transformations, is there a way to get the value of that vertex after the transformations??

-TIA

RigidBody

11-25-2004, 11:13 PM

the vertices do not "go through transformations" in the way you are assuming.there is only ONE modelview matrix.when you call glRotatef or glTranslatef the current modelview matrix is multiplied with a rotation or translation matrix, which results in a new modelview matrix.

Also you can watch that, because they are not passed by reference.

Then call a X function with arguments passed by copy of arguments and not the address, dosent modify your arguments.

Mean that x,y,z will only have a modification only if you modificate them, or they are local values calculated each time when entering in the actual function (brace scope).

If you whant "locals" that keep the values over diferent calls to your actual funtion, then you should declare them like static.

MaNDROiD

11-26-2004, 07:15 PM

I am aware that there is only one model view matrix. what I want is the value of the vertex AFTER it gets multiplied by the matrix.

And also umm...Call me an idiot, but I didn't understand your post hgb...could you please clarify or restate it...thanks.

...

glMatrixMode(GL_MODELVIEW);

glLoadIdentitiy();

glRotatef(90, 0, 1, 0);

...some more transformations...

glBegin(GL_POINT);

glVertex3f(10.0, 0.0, 0.0);

glEnd();

...

how do i get the value of the point after this executes??

RigidBody

11-26-2004, 11:40 PM

you can use

GLfloat mm[16];

glGetFloatv(GL_MODELVIEW_MATRIX, mm);

to get the current modelview matrix and then multiply it with the point coordinates.

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