Skip to main content
GameDev.net gamedev.net
🔒 Locked

Matrix problem

Started by srky982 Mar 21, 2007 at 2:28 PM 3 replies 550+ views
Original Post
srky982
srky982
Hi,if someone can tell me where i am wrong: 1) If i have a code like this: ------------------------------------------------ GLfloat *a[16]; float c; float d; c=1.0f; d=0.0f; a[0]=&ca[4]=&da[8]=&da[12]=&d a[1]=&da[5]=&ca[9]=&da[13]=&d a[2]=&da[6]=&da[10]=&ca[14]=&d a[3]=&da[7]=&da[11]=&da[15]=&c ------------------------------------------------ I did some rotations in my program and after them i call: glLoadMatrixf(a); But some wierd things happened,shouldnt that be equal like calling: glLoadIdentity(); 2) Where are data of Matrix stored if i dont load a new Matrix? Lets say i run a third NeHe tutorial and want to get Matrix? Thanks a lot for helping a noob:)
Brother Bob
Brother Bob
1: glMulsMatrix want's a pointer to 16 GLfloat, you're passing a pointer to 16 pointers to GLfloat. Not anywhere near what glMultMatrix wants.

2: What matrix are you talking about?
srky982
srky982
1)I see now the declaration was completely wrong.Thanks!
2)I was talking about the matrix that was loaded by default in openGL
There must be one if I do all the transforms but how to get data from it?
Brother Bob
Brother Bob
You can get the matrix with glGetFloatv. Pass the matrix you want, like GL_MODELVIEW_MATRIX, and a pointer to where you want the values stored.
srky982
srky982
Thanks a lot!You told me everything i wanted to know,for now:)

Topic Locked

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

Sign in to reply to this topic.