[Interest] [Qt 3D] Using an orthographic projection

Adrián Chaves Fernández adriyetichaves at gmail.com
Fri Mar 25 08:06:36 CET 2016


I am working on a game engine with a top-down view where X represents
North-South, Y represents West-East, and Z is the height (so, Y and Z are
switched, regarding the OpenGL standard).

So far I have been successfully using a perspective projection (with some
help
<https://forum.qt.io/topic/65277/top-down-view-nothing-visible-with-qcamera-at-0-1000-0-everything-visible-at-0-1000-0-01>),
but I would like to switch to an orthographic projection.

However, I have no idea how to do so. This is what I got so far, but it is
not working as I expect:

    cameraEntity->setUpVector(QVector3D(0, 1, 0));
    cameraEntity->setViewCenter(QVector3D(0, 0, 0));
    cameraEntity->setPosition(QVector3D(0.0f, 0.0f, 5.0f));
//     cameraEntity->lens()->setPerspectiveProjection(60.0f, 16.0f / 9.0f,
2.0f, -1.0f);
    cameraEntity->lens()->setOrthographicProjection(-10.0f, 10.0f, -10.0f,
10.0f, 2.0f, -1.0f);

Is the Y-Z switch the issue here, or is it something else? If the Y-Z
switch is the issue, is there a way to handle it, or do I need to go back
to the OpenGL standard?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160325/97bfffa0/attachment.html>


More information about the Interest mailing list