PDA

View Full Version : GlLoadMatrix() Problems !!



GlDevJon
05-02-2002, 01:34 AM
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();
}

Bob
05-02-2002, 01:40 AM
Maybe you should define aM as an array, and not a single float.

GlDevJon
05-02-2002, 03:05 AM
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

mikael_aronsson
05-02-2002, 03:07 AM
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