Here is the program to display the axes themselves, you only need to sign them:

#include "stdafx.h" #include <windows.h> #pragma comment(lib, "C:\\opengl\\glut32.lib") #include "C:\\opengl\\glut.h" void init(void) { glClearColor(1.0, 1.0, 1.0, 0.0); glShadeModel(GL_FLAT); } void display(void) { glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glLineWidth(3); glBegin(GL_LINE_STRIP); glVertex2d(100,100); glVertex2d(0,250); glVertex2d(100,0); glVertex2d(200,250); glEnd(); glColor3f(0.0, 1.0, 1.0); glBegin(GL_LINES); glVertex2d(-20,-20); glVertex2d(-20,300); glVertex2d(-20,-20); glVertex2d(300,-20); for(int i=-20; i<300;i+=20) { glColor3f(0.0, 0.0, 0.0); glVertex2d(i,-15); glVertex2d(i,-25); glColor3f(0.0, 0.0, 0.0); glVertex2d(-25,i); glVertex2d(-15,i); } glEnd(); SwapBuffers(wglGetCurrentDC()); glFlush(); } void reshape(int w, int h) { glViewport(0,0,(GLsizei)w, (GLsizei)h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-100.0,400.0,-100.0,400.0,1.0,-1.0); } int _tmain(int argc, char **argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow("..."); init(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutMainLoop(); return 0; } 

    1 answer 1

    Here you can find a good lesson on the text output using OpenGL . You probably don’t need to implement glPrint from the lesson, just call the void glCallList(GLuint list) function — just look at the BuildFont function. At the end of the article there are links to projects for different development environments.