Results 1 to 2 of 2

Thread: In Screen Menu Bar

  1. #1

    In Screen Menu Bar

    I am trying to add a Menu bar with in the OpenGL rendering are. The "look at" and the "look from" variables are constantly chainging due to user input but I want this menu to be stationary in relation to the screen. Is there any easy way of doing this? So far I am planning on calculating four points and putting up a texture mapped polygon of the menu every time the viewing coordinates chainge. However if there is a way that is less taxing on my brain and processor I'd like to know it. BTW I am using perspecitve view.
    PS. I already know I can't spell

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2001

    Re: In Screen Menu Bar

    Yes there's an easy way. You can first draw your 3D objects with any perspective you want, and then switch to what's called an 'orthographic projection' to draw the menubar. Sample code :

    void draw_everything ()
    { set_up_perspective ();
    draw_3D_objects ();

    //and now what you have to add:
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity ();
    glOrtho (0, witdh_of_window, height_of_window, 0, -1, 1);
    glMatrixMode (GL_MODELVIEW);
    glLoadIdentity ();

    //and now you're ready to draw in 2D.
    //example : we'll draw a red point at location (10, 30)
    glColor3f (1, 0, 0);
    glBegin (GL_POINTS);
    glVertex2i (10, 30);
    glEnd ();

Similar Threads

  1. GLUT, How to add menu entries into the sub menu??
    By Asura in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-15-2006, 08:27 AM
  2. menu gui
    By ian2k6 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-26-2004, 07:51 AM
  3. Replies: 0
    Last Post: 08-30-2003, 03:54 AM
  4. Getting Rid of Menu Bar
    By DanConti in forum OpenGL: macOS
    Replies: 2
    Last Post: 03-09-2003, 03:50 PM
    By jivedisaster in forum OpenGL: User Software
    Replies: 0
    Last Post: 03-05-2003, 11:01 PM

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