Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Cannot Change Position of Bitmap String

This topic is 2301 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to use openGL to make a simple GUI. Currently I am attempting to display some text. I used this function to display a bitmap string on the screen:

void RenderSpacedBitmapString(int x,int y,int spacing,void *font,const char *string)
glColor3f(0.75, 0.75, 0.75);
const char* c;
int xs=x;
for (c=string; *c != '\0'; c++) {
glutBitmapCharacter(font, *c);
xs = xs + glutBitmapWidth(font,*c) + spacing;

Updown is a variable that is supposed to scroll the text up and down by changing its position. I use this GLUT key function to change it:

static void key(unsigned char key, int x, int y)
if (key=='q') {
} else if(key=='w') {
} else {


The current program generates stats for resources for a crafting system and displays them on the console with cout. It also uses the bitmap strings to post them to the GLUT window. They display perfectly in both places, but I just cannot move them on the GLUT window.

Probably a terrible solution but I solved it.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!