Results 1 to 2 of 2

Thread: QMatrix4x4 to glTranslatef and glRotatef Values

  1. #1
    Join Date
    Feb 2011
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QMatrix4x4 to glTranslatef and glRotatef Values

    Hi,

    I used QMatrix4x4 to save my transformation. I could also translate my OpenGL Matrix with ;
    Qt Code:
    1. qreal *data = m.data();
    2. glTranslatef(data[12], data[13], data[14]);
    To copy to clipboard, switch view to plain text mode 

    but i cant calculate rotation degrees from QMatrix4x4 for glRotatef simply! With complex math's would be calculable but than no sin to use QMatrix.

    Thanks

  2. #2
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QMatrix4x4 to glTranslatef and glRotatef Values

    You could use glMultMatrixd() with the entire Matrix to apply your transformation in OpenGL instead of using glTranslatef() and glRotatef().
    But what you really want is the Frame object from libQGLViewer. You can apply translations and rotations to it or any transformations composed from a vector and an angle and it has a method to output the GLdouble* matrix for OpenGL directly.

Similar Threads

  1. Get Co-ordinates Values
    By amitpatel22 in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2011, 11:12
  2. QwtRasterData and values
    By DKL1972 in forum Qwt
    Replies: 12
    Last Post: 10th March 2010, 09:53
  3. Replies: 1
    Last Post: 14th April 2009, 10:49
  4. QComboBox values?
    By dbrmik in forum Newbie
    Replies: 8
    Last Post: 9th January 2009, 08:32
  5. How to read and get the values out of the xml?
    By dark1988 in forum Qt Programming
    Replies: 1
    Last Post: 26th July 2008, 00:29

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.