How to draw north/east arrows..??

Hello friends…

As i said i am developing GIS sort of application, i need to display North/East arrow at the top right corner…

How do i do this…?? whatever may happen, those arrows should be on the top right corner itself… I mean even if the canvas is rotated, zoomed or panned, it should be constant on its place…

Can anyone help me please…??

Thanks in advance…

After having drawn the scene, (i can be rotated translated etc), you can reset the GL_MODELVIEW and GL_PROJECTION matrices with glLoadIdentity() for each.
Then draw your HUD infos

If fixed functionality is used, I rather suggest you to use glPushMatrix() to save current state of the matrix at the top of matrices stack, and then set adequate transformation. The identity matrix for modelview, and some glOrtho for projection. It is not so important for a modelview, because probably you will reset it at the beginning of drawing a new frame, but you’ll skip calculation of projection matrix.

If i use glPushMatrix(), then pixel information will remain same as before or will it change…??

How will i get the changed value of the pixel, when it is zoomed or rotated or panned…??

Thanks again…

glPushMatrix() copies matrix at the top of the stack an sets it as a new top. After execution of glPushMatrix() the same matrix is on the top and below it. The following commands modify only matrix at the top. After you finish whatever you want, just call glPopMatrix() to remove top matrix, and you are at the state you’ve been before (without need to recalculate previous). This mechanism is used for hierarchical modeling, but can be useful also for changing a projection matrix.

The pixel zoom factors are not affected by ModelView or Projection matrix. They are set by glPixelZoom() function. But geometric transformations are affected. To restore previous state (saved with glPushMatrix() call), just call glPopMatrix(). Please, distinguish pixels from vertices.

I sincerely recommend the OpenGL Programming Guide, or some similar book. It is worth having such a book. :slight_smile: