Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6899959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:29:14+00:00 2026-05-27T07:29:14+00:00

I have been trying to create a hud in my OpenGL application. Having looked

  • 0

I have been trying to create a hud in my OpenGL application. Having looked around, it seems the way to do it is with an ortho projection, but so far I have not been able to get the program to render correctly. What is happening is instead of rendering on top of my display, I’m getting odd graphical glitches as seen here:

enter image description here

If I comment out the hud code, everything renders perfectly.

glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);

//Set up projection matrix
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//Using gluPerspective. It's pretty easy and looks nice.
gluPerspective(fov, aspect, zNear, zFar);

//Set up modelview matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

//3D rendering

glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,window_width,0,window_height); //left,right,bottom,top

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor3f(0.0,0.0,1.0);
glBegin(GL_QUADS);
    glVertex2f(50,50);
    glVertex2f(50,100);
    glVertex2f(100,100);
    glVertex2f(100,50);
glEnd();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:29:14+00:00Added an answer on May 27, 2026 at 7:29 am

    Once you’re done rendering the HUD, you need to re-enable the depth writes

    glDepthMask(GL_TRUE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to create a new google custom search engine, but when
I have been trying to create a directory in /sdcard programmatically, but it's not
I have been trying to create an application to go through our database at
I have been trying to create a simple application that will let the user
I have been trying to create a new file inside of my application support
I have been trying to create a fairly simple application in WPF following the
I have been trying to create a Class for my OpenGL ES 2.0 +
I have been trying to create a torrent site but I'm stuck with the
I have been trying to create a deque in Java, but I get a
I have been trying to create a basic rails application. I used generate to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.