PDA

View Full Version : How to get the position of the object inserted in displaylist?



tgtt
02-14-2004, 12:16 AM
Such as:

glNewList(i,GL_COMPILE);
DrawObject();
glEndList();

void main()
{
....
glTranslatef(..);
glRotatef(..);
....//do some other change but can't get the matrix(such as glGetFloatv(GL_MODELVIEW_MATRIX, matrix))here!
glCallList(i);
}

//The displayList's position will changed at any time.how can we get the position of the object inserted in the list?

DarkWIng
02-14-2004, 03:18 AM
a) This not advanced question.
b) You posted the same questions on GameDev
c) Don't post 3 questions in row like that
d) Learn to search for the anwsers

tgtt
02-14-2004, 10:47 PM
I'm sorry very much.

I'really can't get the matrix before call the displayList.So I think it's a advance question.

Bob
02-15-2004, 01:51 AM
Any particular reason why you can't get the matrix?

tgtt
02-15-2004, 11:43 PM
Because I have inserted this displayList into another displayList:

glNewList(j,GL_COMPILE);
//translation,rotation,and some other things
will changed at sometime.
glEndList();

Bob
02-16-2004, 12:21 AM
But if you have transformations inside the display list, you know that these transformations are static, so you always know what kind of transformations are done to the object inside the display list before the object is drawn. So get the matrix before callig the display list and multiply this by matrix by the matrix formed by all transformations in side the display lists, and you will get the matrix at the point you draw the object.