Sign in to follow this  
AoS

OpenGL Cannot Change Position of Bitmap String

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:
[code]
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++) {
glRasterPos2i(5+xs,-225+5*y+updown);
glutBitmapCharacter(font, *c);
xs = xs + glutBitmapWidth(font,*c) + spacing;
}
}
[/code]

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:
[code]
static void key(unsigned char key, int x, int y)
{
if (key=='q') {
updown=updown-10;
} else if(key=='w') {
updown=updown+10;
} else {
}

glutPostRedisplay();
}
[/code]

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this