PDA

View Full Version : XYZ coordinates on the bottom right corner of the screen



billy
04-04-2002, 05:45 AM
What is the best way to draw XYZ coordinate system on the bottom right corner of the screen.

Should you do this with OpenGL or with gdi?
Does anyone know of source code to do this?

Thanks,

Billy.

Pat
04-04-2002, 11:12 AM
Try something like this:

glGetIntegerv glgViewport, vp(0)

glClear clrDepthBufferBit

glMatrixMode mmProjection
glPushMatrix

'create orthographic box for axes
glLoadIdentity
glOrtho -3, 3, -3, 3, -3, 30

glMatrixMode mmModelView
glPushMatrix

'get the camera angle relative to model
'to properly postion the axes
glLoadIdentity

gluLookAt 0, 0, 5, 0, 0, 0, 0, 1, 0

GetCurrentRotMatrix m16()
glMultMatrixf m16(0)

'place axes in the corner
glViewport vp(2) - vp(3) * 0.325, 0, vp(3) * 0.325, vp(3) * 0.325

'draw axes here

glPopMatrix
glMatrixMode mmProjection

glPopMatrix
glMatrixMode mmModelView

'restore viewport
glViewport vp(0), vp(1), vp(2), vp(3)

billy
04-05-2002, 12:14 AM
Thanks Pat.

I will certainly try this.

billy
04-05-2002, 05:20 AM
Sorry Pat.

I implemented your code and it is working quite ok. I just have one problem. I need to erase the transformation matrix before I call the existing matrix.

This is becuase I want to isolate only the rotation and not the whole transformation which includes translations.