Results 1 to 5 of 5

Thread: drawing stationary 2d primitives & using gluLookAt

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2009
    Location
    USA
    Posts
    3

    drawing stationary 2d primitives & using gluLookAt

    So I appologize in advance if this is a basic question, but its hard to find anything regarding what I need because of the keywords involved.

    But here is the issue:

    I want to draw 2d buttons using primitives, but I need the buttons to always be at the bottom of the screen even if I am changing where the camera is positioned and what direction it is looking at.

    Do I always need to draw them based on the camera location? or is there a simpler way to do this?

    If I need to provide more details, let me know.

  2. #2
    Junior Member Newbie
    Join Date
    Nov 2009
    Location
    Russia
    Posts
    7

    Re: drawing stationary 2d primitives & using gluLookAt

    You could always move the camera (the scene, actually) after you've drawn the buttons, for instance.

    Alternatively, to avoid unnecessary glitches you can switch to the orthographic projection (glOrtho) after you've drawn the scene, clear the depth buffer but not the color one, then just draw the buttons on top of the picture.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2009
    Location
    USA
    Posts
    3

    Re: drawing stationary 2d primitives & using gluLookAt

    When I draw the buttons in glOrtho after i've drawn the scene, they still seem to be moving if the camera position is moved.

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2009
    Location
    Russia
    Posts
    7

    Re: drawing stationary 2d primitives & using gluLookAt

    Do glPushMatrix() and glPopMatrix() help? Or glLoadIdentity() for the modelview matrix before you draw the buttons?

    Maybe you can use the stencil buffer to draw the buttons beforehands and then draw the scene in the free pixels...

  5. #5
    Junior Member Newbie
    Join Date
    Nov 2009
    Location
    USA
    Posts
    3

    Re: drawing stationary 2d primitives & using gluLookAt

    Ahhh I needed to call glLoadIdentity()! Thanks for the help, I think all is working for now!

Similar Threads

  1. Performance Issue: Drawing many primitives (>1M)
    By alicana in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 04-19-2015, 03:10 AM
  2. low performance in drawing primitives
    By atteal in forum OpenGL: macOS
    Replies: 1
    Last Post: 08-03-2012, 12:45 PM
  3. Drawing primitives:
    By anoop4real in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-01-2009, 05:34 AM
  4. Drawing stationary text in relation to the camera
    By Psiborg in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-05-2006, 07:10 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