I am writing a simple game in c++ using opengl in a windows system.
I have the scene and I need some informative text to appeared to the left top/bottom of the screen
I am printing these messages with a little plane and the text on it, but I want them to be aligned at the corners of the screen.
So I've read this question here and I thought it seemed quite good and closer to my needs.
So, this is some of my code already used:
In init function of openGL:
glShadeModel (GL_SMOOTH); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glClearDepth(1); glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
In the Resize function:
if (window_height == 0) window_height = 1; glViewport(0, 0, window_width, window_height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0, (float)window_width/(float) window_height, 1.0, 550.0);
And finally in the render function:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -250); //is used for making the scene visible RenderScene(); glutSwapBuffers();
I've tried using the ready3D() and then RenderScene() functions but the scene looked a lot different to what I was aiming.
How can I achieve this simple HUD (printing messages aligned to the window's corners)?
This is what I see (terrain and message below):
I want the message to be aligned at the bottom left corner as well as other messages.