ufk*_*ufk 4 c++ opengl projection
我想对3D场景使用倾斜投影进行菜单和透视投影.有没有办法将这两个投影结合起来?
一般来说,我问如何在我的3d场景中为opengl创建菜单.
使用c ++语言编程.
谢谢!
没问题.只需使用适当的模型视图和投影矩阵绘制3D场景.然后加载2D矩阵,关闭深度测试,并渲染菜单.这是一个它可能是什么样子的例子.
glEnable(GL_DEPTH_TEST)
glMatrixMode(GL_MODELVIEW);
--code to load my Perspective Modelview Matrix
glMatrixMode(GL_PROJECTION);
--code to load my Perspective Projection Matrix
--code to draw my 3D scene
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glMatrixMode(GL_PROJECTION);
--code to setup my "menu" coords, probably something like
gluOrtho2D
glDisable(GL_DEPTH_TEST)
--code to draw the menus
Run Code Online (Sandbox Code Playgroud)