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 8215803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:54:32+00:00 2026-06-07T11:54:32+00:00

I’m new to OpenGL, and I’ve been going through NeHe’s tutorials and various other

  • 0

I’m new to OpenGL, and I’ve been going through NeHe’s tutorials and various other web sources, and I’m testing some things to render text as a HUD of sorts over everything else.
After a very long night, I can’t get this to work and I can’t find any solutions here that work, so I thought I’d ask.

My code:

GLvoid glLoadHUD(GLvoid)
{
    glPushAttrib(GL_LIGHTING_BIT |
                    GL_DEPTH_BUFFER_BIT |
                    GL_TEXTURE_BIT);

    glDisable(GL_LIGHTING);
    glDisable(GL_DEPTH_TEST);
    glDisable(GL_TEXTURE_2D);

    glMatrixMode(GL_PROJECTION);
        glPushMatrix();
            glLoadIdentity();
            glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
            glRasterPos2f(0.1f, 0.6f);
            glColor3f(1.0f,1.0f,1.0f);
            glPrint("Test.");
            glRasterPos2f(0.0f, 0.0f);
        glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
    glPopAttrib();

    glEnable(GL_TEXTURE_2D);
    glEnable(GL_LIGHTING);  
    glEnable(GL_DEPTH_TEST);
}    

Which is the code to render the text, and this is the code for drawing the scene:

int DrawGLScene(GLvoid)                                         
{

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clears buffers
glLoadIdentity();

// If I put glLoadHUD(); here, it renders but the models render over it,
    //  which is useless.

for (xloop = 0; xloop < 3;)
{
    glLoadIdentity();
    glTranslatef(-4.0f+(float(xloop)*4.0f),0.0f,-12.0f);
    glCallList(dlstBox);    // This is the call to create a box.
    xloop++;
}


glLoadHUD();  // If I put it here though, it doesn't render at all.

return TRUE;
}

Thank you in advance for any help you could give, I know I’m pretty green and I’m sure it’s staring me right in the face, but this is driving me mad and I’m not sure how to make it work.

  • 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-06-07T11:54:33+00:00Added an answer on June 7, 2026 at 11:54 am

    With glLoadHud after the rest of the scene, your MODELVIEW matrix is still on the stack, and you do not clear it as part of glLoadHud. Thus all of the glTranslatef translations that you accumulate during the scene are still active when you’re drawing the hud, which translates it right out of your viewable window.

    Clear the MODELVIEW matrix as part of the start of glLoadHud and see if that makes a difference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but

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.