Matrix to double??
I want to get Matrix data to double pointer.
in opengl, glLoadMatrix(GLdouble*m); <<< i want to use this, m is matrix info.
i use QMatrix4x4.
i can make my matrix, but, i can't understand matrix to double*.....
why not double*??? so i cant use glLoadMatrix()...:(
As explained here https://www.opengl.org/sdk/docs/man2/xhtml/glLoadMatrix.xml
the pointer should point to 16 doubles (m..m), not one double.
QMatrix4x4 uses floats to store the data, so you can use it with raw OpenGL like this:
QMatrix4x4 someMatrix; glLoadMatrixf(someMatrix.constData());
but i try to double , it's doesnt work...:(
As I said QMatrix4x4 uses 16 floats. You want 16 doubles. So just cast them:
QMatrix4x4 someMatrix; double otherMatrix; for(int i=0; i<16; ++i) otherMatrix[i] = someMatrix.constData()[i];
But are you sure you need the extra precision of doubles? If you do transformations in floats (QMatrix4x4) and convert only the result to doubles then you're wasting time and bandwidth.
i dont know but it maybe just error, this post didn't regist...:(
so i use glLoadMatrixf()!!
i apply glLoadMatrixf(m.ConstData()); about lookat matrix..
it's dont occur error! build seccess!
but there is no change(like camera move), just like before :(