Results 1 to 4 of 4

Thread: Accessing matrices in opengl

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2000
    Posts
    1

    Accessing matrices in opengl

    I'd like to be able to store a matrix produced by transformations, but I can't seem to find a command that will let me. I'm aware of the matrix stacks, but I want to be able to store them permanently and for many different objects. I'd rather not have to write my own matrix library to do all the transformations myself when openGL's is already done. Is there anyway to access the matrices? Thanks,
    Chris

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Adelaide, South Australia, Australia
    Posts
    763

    Re: Accessing matrices in opengl

    Yep. Look at glGetDoublev(GL_MODELVIEW_MATRIX, GLdouble*);
    It'll return the top of the modelview matrix stack. Now, if you want to restore that matrix, just do a glLoadMatrix(GLdouble*);

    cheers,
    John

  3. #3
    Senior Member Regular Contributor
    Join Date
    May 2000
    Location
    Manchester - UK
    Posts
    138

    Re: Accessing matrices in opengl

    Getting data back from OpenGL is pretty slow - if you're hellbent on speed it might be better calculating the matrices yourself. At least then you can use the data for other stuff (collision detection, culling, LOD, blah, blah...)
    Paul Groves
    [b] pauls opengl page

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

    Re: Accessing matrices in opengl

    I really don't think that getting values from OpenGL is as slow as getting framebuffer information, since there is no need to flush the pipeline (I dont know how it is on hardware T&L though). But yeah, you are right Pauly, if you are REALLY in need of speed, you should do it on your own.

Similar Threads

  1. accessing a specific mip level in OpenGL ES 2.0
    By kend in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 06-06-2014, 02:30 PM
  2. Accessing OpenGL state variables in Cg Problem
    By apapaxionga in forum OpenGL: GLSL
    Replies: 1
    Last Post: 11-03-2011, 03:44 PM
  3. Accessing mesa's OpenGL 2.1 features
    By timday in forum OpenGL: Linux
    Replies: 1
    Last Post: 08-31-2008, 09:50 AM
  4. accessing matrices
    By powerpad in forum OpenGL: GLSL
    Replies: 8
    Last Post: 06-18-2005, 03:02 PM
  5. accessing a video stream on Windows in opengl?
    By Lorax in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 01-07-2002, 02:06 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