简体   繁体   中英

OpenGL get 2d projection from 3d points

I have display a collection of 3d cloud points by this code:

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
if (keyframes[i]->numberOf3DPoints > 0)
{
    glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(PointColor), ((uint8_t*)keyframes[i]->points+12));
    glVertexPointer(3, GL_FLOAT, sizeof(PointColor), ((float*)keyframes[i]->points));
    glDrawArrays(GL_POINTS, 0, keyframes[i]->numberOf3DPoints);
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);

This code displays an array of 3d point clouds with its color values, I want to get an array of 2d points and display these points in 2d (the upper view of 3d points)

This projection tutorial explains the projection matrix transformations in detail.

To get the projection from above, set the projection matrix and set the camera above and point it in the direction toward the plane. And that should be enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM