Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
4.6.0
-
None
-
Only on platforms where qreal != float
Description
QVector2D, QVector3D and QVector4D classes all have qreal accessors, constructors and mutators but store the data as floats. This has has important repercussion as it means that this code will fail:
qreal val = double(std::rand())/double(RAND_MAX);
QVector3D vec(val,val,val);
QCOMPARE(vec.getX(), val); // MIGHT FAIL!
QCOMPARE(vec.getY(), val); // MIGHT FAIL!
QCOMPARE(vec.getZ(), val); // MIGHT FAIL!
This also causes problems for us as we need values to be stored as doubles. And they are not. I suspect that the argument for storing floats internally is because OpenGL uses floats, but QVectorXD are NOT part of QtOpenGL but are part of qtGui and therefore should not be OpenGL specific. In addition, QQuaternions do use qreal as storage.
Should floats be needed for OpenGL, conversion should be done as late as possible.
Thanks and keep up the good work!
J-O
Attachments
Issue Links
- resulted in
-
QTBUG-8216 Undocumented: QVector2D, QVector3D and QVector4D have qreal interfaces but use float as storage
-
- Closed
-