Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: How to get projection matrix???

  1. #1
    Junior Member
    Join Date
    Jan 2005
    Location
    UK
    Posts
    28

    How to get projection matrix???

    Hi,

    glgetdoublev is omitted from OGL ES. How can i immitate its usage??
    i would like to get the projection and modelview matrices.

    best
    Fad

  2. #2
    Senior Member
    Join Date
    May 2006
    Posts
    353
    Use glGetFloatv.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  3. #3
    Junior Member
    Join Date
    Jan 2005
    Location
    UK
    Posts
    28

    question

    But is that available in ES 1.0?? I now it is in ES1.1 only!!

  4. #4
    Senior Member
    Join Date
    May 2006
    Posts
    353
    In OpenGL ES 1.0 you have to use the OES_query_matrix extension.

    Code :
    // global scope
    typedef GLbitfield (APIENTRY * PFNGLQUERYMATRIXXOES) (GLfixed mantissa[16], GLint exponent[16]);
    PFNGLQUERYMATRIXXOES glQueryMatrixxOES;
     
    // your init function
    // before this, make sure that "OES_query_matrix" is part of the extension string
    glQueryMatrixxOES = (PFNGLQUERYMATRIXXOES) eglGetProcAddress("glQueryMatrixxOES");
     
    // where you want to use it
    glMatrixMode(GL_MODELVIEW);
    GLfixed mantissa[16];
    GLint exponent[16];
    GLbitfield validcomponents = glQueryMatrixxOES(mantissa, exponent);
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  5. #5
    Junior Member
    Join Date
    Jan 2005
    Location
    UK
    Posts
    28

    CHEERS

    THANX XMAS

  6. #6
    Junior Member
    Join Date
    Jan 2005
    Location
    UK
    Posts
    28

    How to use the output???

    Hi (Xmas),

    I managed to apply the code you provided me. However, the results in mantisa are too large fixed values (tens of thousends when shifted to integers). what do these values really mean?? an what is the need for epxonent in this case??

    cheers

  7. #7
    Junior Member
    Join Date
    Jan 2005
    Location
    UK
    Posts
    28

    reply to my post

    I managed to find a way to get the exact value of the matrix fields. correct me if i am wrong:

    matrix[i] = mantisa[i]*2^exponent[i]

    Cheers

  8. #8
    Senior Member
    Join Date
    May 2006
    Posts
    353
    That is correct. The reason for the separate mantissa and exponent was to enable this extension to return both fixed point and floating point internal representations accurately.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  9. #9
    Junior Member
    Join Date
    Jan 2005
    Location
    UK
    Posts
    28
    Hi,

    I have posted this tread long time ago and i found it useful. However now i am facing a limitation with the usage of the method to retreive the projection and model-view matices.

    the code below suggests querying the matrix needed just after loading it:

    Code :
    // global scope 
    typedef GLbitfield (APIENTRY * PFNGLQUERYMATRIXXOES) (GLfixed mantissa[16], GLint exponent[16]); 
    PFNGLQUERYMATRIXXOES glQueryMatrixxOES; 
     
    // your init function 
    // before this, make sure that "OES_query_matrix" is part of the extension string 
    glQueryMatrixxOES = (PFNGLQUERYMATRIXXOES) eglGetProcAddress("glQueryMatrixxOES"); 
     
    // where you want to use it 
    glMatrixMode(GL_MODELVIEW); 
    GLfixed mantissa[16]; 
    GLint exponent[16]; 
    GLbitfield validcomponents = glQueryMatrixxOES(mantissa, exponent);
    in this case i will be able to query the GL_PROJECTION matrix only once in the init function as it is loaded only then.
    How can i query it at any time in the code?

    thanx
    Fadi

  10. #10
    Senior Member
    Join Date
    May 2006
    Posts
    353
    Quote Originally Posted by Fadi Chehimi
    the code below suggests querying the matrix needed just after loading it:
    I don't see where it suggests that. Once you have initialized the function pointer you can use glQueryMatrixxOES anywhere (provided it is declared at global scope).

    But again, please check that "OES_query_matrix" can be found in the extension string (and that the pointer returned by eglGetProcAddress is not NULL) before you use the extension.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

Page 1 of 2 12 LastLast

Similar Threads

  1. two-point perspective projection
    By dsasha in forum OpenGL ES general technical discussions
    Replies: 3
    Last Post: 06-03-2009, 03:43 AM
  2. How to get current MODELVIEW MATRIX and PROJECTION MATRI
    By czaoth in forum OpenGL ES general technical discussions
    Replies: 2
    Last Post: 05-21-2005, 02:57 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
  •