[osg-users] Projection matrix with camera looking along +Z. No redering at all.

Alexander Savo alexandr.savochkin at gmail.com
Wed Jul 24 19:34:16 PDT 2019


Hi OSG community,

I defined my projection matrix for camera looking along +Z direction and I put a sample object at position (0,0,13). Surprisingly, it was not rendered.

Here is my projection matrix:

    1.4792376379346175f, 0.00000000000000000f, 0.00000000000000000f, 0.00000000000000000f,
    0.00000000000000000f, -2.0192066395065309f, 0.00000000000000000f, 0.00000000000000000f,
    0.057592616993668688f, -0.20414287633544836f, 1.0000000000000000f, 1.0000000000000000f,
    0.00000000000000000f, 0.00000000000000000f, -1.0000000000000000f, 0.00000000000000000f


I am pretty sure my math is correct since I tested it with both pen-and-paper and I also created plain OpenGL application with this matrix and a tetrahedron around (0,0,13) and it was rendered without a hitch.

I know that there is a convention that camera looks along -Z axis but I don't think there should be anything preventing me from defining projection matrix for "+Z looking camera"

Do you have any idea why it doesn't work in OSG?

I have attached both OSG and OpenGL programs which use this projection matrix.

I am wondering if OSG does any optimizations like discarding everything with Z>0 and if it does, how can I switch it to the opposite behavior?

Thank you in advance!

Cheers,
Alexander

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76487#76487




Attachments: 
http://forum.openscenegraph.org//files/opengltest_341.cpp
http://forum.openscenegraph.org//files/osgapp_160.cpp




More information about the osg-users mailing list