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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:32:05+00:00 2026-06-17T17:32:05+00:00

Here is my if statement that detects a bomb threat (just a game I’m

  • 0

Here is my if statement that detects a bomb threat (just a game I’m making)…

if (exodus2_bomb == 1)
{
    float exodus2_theta_math = (exodus2_theta)/10.0*M_PI;
    float exodus2_phi_math = (exodus2_phi)/10.0*2*M_PI;
    r_exodus2_x = radius_exodus_pos * sin(exodus2_theta_math) * cos(exodus2_phi_math);
    r_exodus2_y = radius_exodus_pos * sin(exodus2_theta_math) * sin(exodus2_phi_math);
    r_exodus2_z = radius_exodus_pos * cos(exodus2_theta_math);  

    glPushMatrix();
    glTranslatef(r_exodus2_x,r_exodus2_y,r_exodus2_z);
    glColor3f (1.0, 0.0, 0.0);        
    glRasterPos3i(exodus2_x/10,exodus2_y/10,exodus2_z/10);
    string exodus2 = "BOMB!!";
    void * fontexodus2 = GLUT_BITMAP_HELVETICA_10;
    for (string::iterator i = exodus2.begin(); i != exodus2.end(); ++i)
    {
        char c = *i;
        glutBitmapCharacter(fontexodus2, c);
    }
    glEnd();
    glPopMatrix();

    glPushMatrix();
    glTranslatef(r_exodus2_x,r_exodus2_y,r_exodus2_z);
    glColor3f (1.0, 0.0, 0.0);        
    glRasterPos3i(exodus2_x/10,exodus2_y/10,exodus2_z/10);
    string exodus2b = "\n THREAT LEVEL 1";
    void * fontexodus2b = GLUT_BITMAP_HELVETICA_10;
    for (string::iterator i = exodus2b.begin(); i != exodus2b.end(); ++i)
    {
        char c = *i;
        glutBitmapCharacter(fontexodus2b, c);
    }
    glEnd();
    glPopMatrix();
}

What I would like to have is a carriage return between “string exodus2” and “string exodus2b”. However, it is always on one line. And I don’t have the real estate onscreen for that.

Is it possible to add a carriage return somewhere in my string iterator?

Unfortunately, screwing around with “glTranslatef” and “glRasterPos3i” only results in the distance between the two lines of text NOT being consistent as I move the camera.

  • 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-17T17:32:06+00:00Added an answer on June 17, 2026 at 5:32 pm

    You need to render each string separately, and modify the raster position appropriate to reset the string’s position. If you use glutBitmapHeight, you can determine how far you need to move the raster position “down” to emulate a new line.

    If you want the strings to be positioned in 3D, but then to “act” like they’re restricted to the same plane in 2D, you can use the glBitmap command to modify the raster position in screen space.

    int lineHeight   = glutBitmapHeight( font );  // number of pixels between "lines"
    int stringLength = glutBitmapLength( font, s1 );  // returns length of string 1 in pixels
    
    glutBitmap( 0, 0, 0, 0, -stringLength, lineHeight, NULL );  // move raster position
    glutBitmapString( font, s2 );
    

    the fifth and sixth parameters of glBitmap control how far the raster position is moved.

    Alternatively, if you want these strings to be anchored in a position relative to the window, as compared to a point in your 3D space, check out glWindowPos.

    By the way, all of these functions are deprecated with OpenGL 3.0, removed in OpenGL 3.1, unless you use a compatibility context in verisons of OpenGL greater than 3.2.

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

Sidebar

Related Questions

Here's a LINQ statement that I am trying to execute var usersQuery = from
Reading about Delphi's Exit statement (see here for instance), I cannot ignore that writing
Here is a PHP statement that basically sets off a javascript image slider. Only
I have a SQL statement (that I can't post here). When I look at
OK, so here what I need. I have an if statement that if it
I have a table Table1 with 6 columns. Here is the sql statement that
Just fishing for ideas- I have a SQL statement that I need to parse
I have these long statements that I will refer to as x,y etc. here.
Here is the problem statement: Calling a setter on the object should result in
Here is my select statement, SELECT TOP 1 EmpId, RemainingAdvance FROM SalaryDetails WHERE EmpId

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.