0

Is it is possible to have a openGL window where one part is fixed and other rotate or traslate with the camera.

To be more clear. I want a control bases screen. I want the control(may be buttons generated in square form) to be fixed while the rest screen move with the camera. Can any one tell me if it is feasible?

KillianDS
  • 16,936
  • 4
  • 61
  • 70
duck
  • 2,483
  • 1
  • 24
  • 34

2 Answers2

2

OpenGL is not a scene graph. It's a state controlled drawing API. Things are drawn as you call OpenGL functions. It's perfectly possible to draw one thing using a set of projection and modelview matrices and viewport A then change projection, modelview and viewport to set B and draw further things.

I leave the rest to your imagination.

Big fat hint, hopefully making it click: If you set the viewport and projection in some window resize handler, move this code into the drawing code.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
0

To achieve this effect you need to first draw your 3D scene using a perspective projection and then switch to an orthographic projection and draw your 2D control elements. This process is then repeated each frame. The technique is outlined here.

StuGrey
  • 1,479
  • 9
  • 20