开发者

draw relative to camera position

开发者 https://www.devze.com 2023-02-02 09:12 出处:网络
recently my boss told me to modify an opengl application. It uses gluLookAt to set the camera position.

recently my boss told me to modify an opengl application. It uses gluLookAt to set the camera position. I'd have to draw a toolbar relative to that position so that the user could always see it.

I'm almost a complete beginner in openGL, so I don't really know what would be easier, doing all the translations and rotations myself so I could draw the 开发者_C百科object in camera sight, or using the projection and view matrices? I managed to get the projection and view matrices with the glGetFloatv command, but to be honest, I have no idea how to use them to make the desired transformations. I could just use the basic translation and rotation commands, but I think using those matrices would be easier.

I would be gratefull for any answer :)


What might be easier instead is to change the projection and modelview matrices after drawing the 3D scene. Change the projection matrix to a glOrtho2D, and the modelview so that it scales to fit the screen and then draw the toolbar. See the answers here for specifics:

Opengl drawing a 2d overlay on a 3d scene problem

0

精彩评论

暂无评论...
验证码 换一张
取 消