-
GlLoadMatrix() Problems !!
Hi,
i want to load a matrix with glLoadMatrix() function, simply to translate an object in my scene.
for begining, i replace "glLoadIdentity()" by glLoadMatrix(&aM);
but the result is not self than "glLoadIdentity()" .
Why ?
this is my code:
float aM = {1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1};
void Display()
{
glClear(GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT);
//glLoadIdentity();
glLoadMatrixf(&aM);
gluLookAt(0,0,10,0,0,0,0,1,0);
glBegin(GL_TRIANGLES);
glutSolidSphere(1, 20, 20);
glEnd();
glutSwapBuffers();
}
-
Senior Member
OpenGL Guru
Re: GlLoadMatrix() Problems !!
Maybe you should define aM as an array, and not a single float.
-
Re: GlLoadMatrix() Problems !!
At the base, i have used from a bidimensional array (m[4][4]) , and i have converted this in a unidensional array (m[16]). but result as a black screen.
Maybe somebody have a sample of use?
Thank
-
Re: GlLoadMatrix() Problems !!
Yes, change it to an array (float aM[] = ...) and then also change the &aM in the function call to just aM without the & character, then it should work fine.
Mikael
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules