Results 1 to 4 of 4

Thread: Manually create a model-view matrix?

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2009
    Posts
    2

    Manually create a model-view matrix?

    How do I manually create a model-view matrix?
    I'm making a 2d game, and would like to store matrices representing transformations for animation.

    How can I create a matrix in the format which openGL "understands"?
    Also, how would I then use it?

    Cheers! Thanks in advance

    TheSamuraiElephant

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,649

    Re: Manually create a model-view matrix?

    Quote Originally Posted by TheSamuraiElephant
    How do I manually create a model-view matrix?
    Need more detail. You can create it anyway you want! It's just a 4x4 matrix that transforms positions from object-space to eye-space. Most intro to graphics books cover this.

    You can let OpenGL create it for you, one transform at a time. Just set glMatrixMode( GL_MODELVIEW ) and start ripping out transforms (glTranslate, glScale, etc.).

    The only thing really OpenGL-specific about the matrix is that it follows the column-major operator-on-the-left (P*V*M * v1 = v2) convention. Which is the same as row-major operator-on-the-right (v1 * M*V*P = v2).

  3. #3
    Senior Member Regular Contributor
    Join Date
    Oct 2009
    Posts
    132

    Re: Manually create a model-view matrix?

    http://www.morrowland.com/apron/tuto.../gl_matrix.php

    Here is a nice explanation of what each part of the matrix does. The Red Book also goes through it quite well.

    A format that OpenGL understands is a float m[16], column major, so the translation is in elements m[12~14]

  4. #4
    Junior Member Newbie
    Join Date
    Jun 2009
    Posts
    2

    Re: Manually create a model-view matrix?

    Thanks for the help both of you! My original question was not phrased very well, and what I actually meant was how does OpenGL store matrices? James A seems to have answered my question - an array of floats with 16 length

    I understand now - thanks for the help again!

Similar Threads

  1. Model View matrix
    By Sly_Raccoon in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-07-2015, 10:24 AM
  2. model view matrix and view direction
    By sajis997 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-27-2014, 03:24 AM
  3. View matrix/model matrix woes
    By Vexator in forum OpenGL: General
    Replies: 0
    Last Post: 07-28-2011, 06:17 AM
  4. Model View Matrix Value when using MFC
    By miztaken in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 07-12-2010, 02:48 PM
  5. Need an advice on separating model matrix from view matrix.
    By Obli in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 10-09-2003, 06:07 AM

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