Results 1 to 4 of 4

Thread: HUD Always draw on top?

  1. #1
    Member Contributor
    Join Date
    Sep 2006
    Location
    US(California)
    Posts
    58

    HUD Always draw on top?

    I am working on a heads up display interface using/rendering quads.

    How could I ensure that the interface will always be drawn over the world geomatry of the game?

    Do I need to somhow modify the ZBuffer?
    -Josh

  2. #2
    Senior Member Regular Contributor
    Join Date
    Dec 2005
    Posts
    256

    Re: HUD Always draw on top?

    I am pretty sure you just need to render your display interface last. Swith to Ortho view and render last. You can also turn gldepthmask(false) before drawing your GUI, and then turn it on again (set to true). That way you ensure is drawn ontop. That would be enough (if not others will correct me )

    The point is: don't use the zbuffer, use ortho view and forget about the third dimension!

    Cheers,
    Rod

  3. #3
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,107

    Re: HUD Always draw on top?

    if not others will correct me

    Actually you need to disable the depth test: glDisable(GL_DEPTH_TEST). Depth mask is irrelevant if you draw your interface at the end.

  4. #4
    Senior Member Frequent Contributor
    Join Date
    May 2005
    Location
    Prague, Czech Republic
    Posts
    913

    Re: HUD Always draw on top?

    Originally posted by Rodrix:
    You can also turn gldepthmask(false) before drawing your GUI, and then turn it on again (set to true). That way you ensure is drawn ontop.
    No. The depth mask controls write to the depth buffer not testing aginst it. The testing can be disabled by disabling the depth buffer using glDisable(GL_DEPTH_TEST) or by changing depth function to GL_ALWAYS.

Similar Threads

  1. Rendering terrain - multiple draw calls or draw whole VBO?
    By rakketh in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-19-2013, 02:26 PM
  2. How do I draw separate triangles (not attached) in one draw call?
    By Spankenstein in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-04-2012, 05:48 AM
  3. OSX 1.7 does not draw anything
    By Crashdog in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-08-2012, 11:14 AM
  4. Draw at 3D
    By GLman in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 06-05-2002, 05:25 AM
  5. It just won't draw
    By imported_Robin in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-14-2000, 12:00 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