Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: GlLoadMatrix() Problems !!

  1. #1
    Junior Member Newbie
    Join Date
    May 2002
    Location
    Tournai
    Posts
    2

    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();
    }

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: GlLoadMatrix() Problems !!

    Maybe you should define aM as an array, and not a single float.

  3. #3
    Junior Member Newbie
    Join Date
    May 2002
    Location
    Tournai
    Posts
    2

    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

  4. #4
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    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
  •