Page 1 of 9 12345 ... LastLast
Results 1 to 10 of 87

Thread: glMultMatrixf(GLfloat *m );

  1. #1
    Senior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Slovak Republic( Slovakia )
    Posts
    110

    glMultMatrixf(GLfloat *m );

    I'm trying to transform the modelview matrix.
    I had declared pointer matrix[4][4] of GLfloat.
    And this is a problem code:

    void Transform()
    {

    glMultMatrix()
    glLoadIdentity();

    };

    Then I recived message:The glMultMatrix request reinterpret_cast.
    How I could declare the matrix?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jun 2000
    Location
    B.C., Canada
    Posts
    367

    Re: glMultMatrixf(GLfloat *m );

    As a single dimensioned array:

    GLfloat matrix[16];

    I forget what order the rows and columns are stored though.

    j

  3. #3
    Senior Member Regular Contributor
    Join Date
    Apr 2000
    Location
    Redlands, CA, USA
    Posts
    233

    Re: glMultMatrixf(GLfloat *m );

    or -

    GLfloat matrix[4][4];

    glMultMatrix( matrix[0] );

  4. #4
    Senior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Slovak Republic( Slovakia )
    Posts
    110

    Re: glMultMatrixf(GLfloat *m );

    Thank you very much.

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Dec 2007
    Posts
    1,077

    Re: glMultMatrixf(GLfloat *m );

    Serge K:
    Is that really the clean way to go? I mean, does C guarantee, that in two dimensional arrays, the "columns" follow without physical memory seams?

    OpenGL uses matrices in column order meaning:

    0 4 8 12
    1 5 9 13
    2 6 10 14
    3 7 11 15

  6. #6
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Posts
    370

    Re: glMultMatrixf(GLfloat *m );

    No, that is [B]wrong[\b].

    OpenGL does:

    0 1 2 3
    4 5 6 7
    8 9 10 11
    12 13 14 15

    BTW, why would you Mult the matrix, then call identity?
    Oh, and it is better to do glfloat Matrix[16] As a matter of fact some intresting tricks can be done with this, if you use union. (search the message board, there was a good example of this a few weeks (months?) back.

  7. #7
    Member Contributor
    Join Date
    Aug 2000
    Posts
    68

    Re: glMultMatrixf(GLfloat *m );

    I never used "d arrayer instead I always used 1d and never had any problems.
    If get it to load the check out win32asm.virtualave.net under the programming section for some uses for matrices.

  8. #8
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: glMultMatrixf(GLfloat *m );

    The Red Book says that a matrix in OpenGL is represented the way Michael says.

    Have a look in the online copy of the book. http://ask.ii.uib.no/ebt-bin/nph-dweb/dy...lhtml;pt=7170#X

  9. #9
    Senior Member OpenGL Pro
    Join Date
    Dec 2007
    Posts
    1,077

    Re: glMultMatrixf(GLfloat *m );

    Thanks Bob...
    Shame on you Elixer!

    Oh, you wouldn't need unions to have these cool effects, by the way. You can also set the byte aligning for the structs. Might be a bit unclean, but should work.

  10. #10
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Posts
    370

    Re: glMultMatrixf(GLfloat *m );

    Hmm, well, I know what your looking at, but that is the way math books have it. The way openGL handles it IS the way I said it.

    Or if you like:
    xX Xy Xz 0
    yX yY yZ 0
    zX zY zZ 0
    lx ly lz 1

    And doing a quick seach on google, I found "Matrices can be your Friends. By Steve Baker"
    which also says:
    Take an opengl matrix:

    float m [ 16 ] ;


    Consider this as a 4x4 array with it's elements laid out like this:

    0 1 2 3
    4 5 6 7 THE OPENGL WAY
    8 9 10 11
    12 13 14 15


    Yes, I know mathmaticians like to lay the numbers out differently... They prefer
    to number them like this:

    0 4 8 12
    1 5 9 13 THE MATHEMATICIANS WAY
    2 6 10 14
    3 7 11 15

    --------------

    So are we all happy now? And shame on you all for doubting me!
    (LOL)

Page 1 of 9 12345 ... LastLast

Similar Threads

  1. glMultMatrixf (Symmetry)
    By Erakis in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 02-06-2002, 10:02 AM
  2. glMultMatrixf(GLfloat *m ) is back.
    By FoxDie in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 03-11-2001, 02:23 AM
  3. Using glMultMatrixf w/ glPopMatrix ?
    By gimp in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 03-09-2001, 05:59 AM
  4. Glfloat etc...
    By zzapatista in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-21-2001, 10:22 PM
  5. GLfloat problems
    By imported_robert in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-11-2001, 12:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean