Results 1 to 5 of 5

Thread: How to draw north/east arrows..??

  1. #1
    Member Contributor
    Join Date
    Jun 2009
    Posts
    60

    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..

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: How to draw north/east arrows..??

    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

  3. #3
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,214

    Re: How to draw north/east arrows..??

    Quote Originally Posted by ZbuffeR
    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.

  4. #4
    Member Contributor
    Join Date
    Jun 2009
    Posts
    60

    Re: How to draw north/east arrows..??


    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..

  5. #5
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,214

    Re: How to draw north/east arrows..??

    Quote Originally Posted by rakesh_thp
    If i use glPushMatrix(), then pixel information will remain same as before or will it change..??
    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.

    Quote Originally Posted by rakesh_thp
    How will i get the changed value of the pixel, when it is zoomed or rotated or panned..??
    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.

Similar Threads

  1. OpenGL Jobs on US east coast
    By Coconut in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 05-10-2011, 04:36 AM
  2. OpenGL & MultiThread & East language input in WinXP
    By pango in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 04-29-2006, 10:19 PM
  3. US EAST CS SERVERS !
    By in forum OpenGL: User Software
    Replies: 0
    Last Post: 07-18-2003, 10:51 AM
  4. Replies: 3
    Last Post: 05-21-2003, 07:31 PM
  5. Drawing arrows / coordinate frame
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-27-2002, 06:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean