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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:07:47+00:00 2026-05-31T14:07:47+00:00

I am trying to print some debugging info (FPS, camera location and rotation, etc)

  • 0

I am trying to print some debugging info (FPS, camera location and rotation, etc) in the lower left of the screen. I have set it up so that it works fine using glTranslate() and glRasterPos2f(), but if I try and resize the window, the text is no longer resting perfectly in the corner, and depending on how much I stretch out the window, it may appear in the middle of the screen, or it may start getting cut off. Is there any way to use glPrint() to print text that will be say, 10px from the left, and 10px to the right?

Here is the code I am using:

GLvoid glPrint(const char *fmt, ...){                   // Custom GL "Print" Routine
    char        text[256];                              // Holds Our String
    va_list     ap;                                     // Pointer To List Of Arguments
    va_start(ap, fmt);                                  // Parses The String For Variables
        vsprintf(text, fmt, ap);                        // And Converts Symbols To Actual Numbers
    va_end(ap);                                         // Results Are Stored In Text

    glPushAttrib(GL_LIST_BIT);                          // Pushes The Display List Bits
    glListBase(base - 32);                              // Sets The Base Character to 32
    glCallLists(strlen(text), GL_UNSIGNED_BYTE, text);  // Draws The Display List Text
    glPopAttrib();                                      // Pops The Display List Bits
}

void GLOUT(float xLocation, float yLocation, float colorRed, float colorGreen, float colorBlue){
    glDisable(GL_TEXTURE_2D);
    glLoadIdentity();
    glTranslatef(0,0,-.002);
    glColor3f(colorRed,colorGreen,colorBlue);
    glRasterPos2f(xLocation/10000, yLocation/10000);
    glPopMatrix();
}

enter image description here

  • 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-31T14:07:48+00:00Added an answer on May 31, 2026 at 2:07 pm

    The trick with rendering HUDs or other overlay stuff, is to switch to a more convenient combination of viewport and projection for them.

    You’re not forced to stick to one particular projection with OpenGL. Let me guess: You setup viewport and projection in the window’s resizing handler, right? Suggestion: Move that code to the drawing function, and (hopefully) have an epiphany doing so.

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

Sidebar

Related Questions

I'm trying to print some extra info when in compile a library using ndk-build.
I'm trying to print a JPanel with some painted graphics on it (overriding paintComponent).
I am having some trouble trying to print from a file. Any ideas? Thanks
I've run into some problems debugging a multi-threaded process using GDB. I have a
I have a application with a screen manager class that is causing me some
I'm trying to print a recursive data structure in Perl for debugging purposes. Hash
I have been trying to find some documention on whether it's possible to run
I'm trying to have a debugging mode on so if #define DEBUG 1 I
I am new to using JQuery. I am trying to print preview some part
I have some code in MS VC++ 6.0 that I am debugging. For some

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.