Please provide the following info: Hardware Platform: DRIVE AGX Pegasus™ Developer Kit Software Version: DRIVE Software 10 Host Machine Version: native Ubuntu 18.04 SDK Manager Version: 1.4.0.7363
In render_engine sample, clicking on tiles shows an {x, y, z} coordinate that is generated based on the clicked screen position using dwRenderEngine_screenToWorld3D.
It seems that the world coordinate always has z=0.
What I need to do is click on a point after rendering a point cloud with DW_RENDER_ENGINE_PRIMITIVE_TYPE_POINTS_3D and get the 3D coordinates of a point close to where the mouse is clicked.
Is screenToWorld3D the correct approach, or is there a different way?
To make it clear, the problem is the 3D point returned by dwRenderEngine_screenToWorld3D always results in z=0. This is the same as in the render_engine example as well as my own code. The values of x and y seem correct.
What I am trying to do is commonly done in opengl by first calling glReadPixels to get the GL_DEPTH_COMPONENT (depth value) of the pixel coords. Then calling gluUnProject, with the pixel coords and depth value. This gets the 3D point {x, y, z} in opengl.
However, I can’t do the same in Driveworks. I think gluUnProject is equivalent to dwRenderEngine_screenToWorld3D, but as I described in my original post, z always results in 0.
If I can use glReadPixels to get the GL_DEPTH_COMPONENT, then I can do the matrix operations myself.
However, although glReadPixels works on the host Ubuntu PC (i.e. it returns sensible values of depth: 0.0 < depth < 1.0), it always returns 0.0 on the target Pegasus platform.