![](/img/trans.png)
[英]how to compute the projection/modelview matrix given 3D points and their 2D screen positions in opengl
[英]OpenGL get 2d projection from 3d points
我已經通過以下代碼顯示了3d雲點的集合:
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);
這段代碼顯示了一個3d點雲及其顏色值的數組,我想獲取一個2d點的數組並在2d中顯示這些點(3d點的上方視圖)
本投影教程詳細介紹了投影矩陣轉換。
要從上方獲取投影,請設置投影矩陣並將相機設置在上方,並將其指向朝向平面的方向。 這樣就足夠了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.