Displaying text and integer values on window-OpenGL

I am not experienced with OpenGL. Here is what I am trying to do:

Compare the number of calculations needed for a transformation if: All transformation matrices are applied separately. All transformation matrices are combined into one and that is applied to the shape.

How I have approached it: I have created a menu that allows the user to choose how many transformations and how many nodes the shape will have. This appears to be working fine. Then supposedly the relevant values are displayed.

What I need help with: Neither the initial text (Right click to choose parameters) or the text to display the values appear on the window. If I try to use glWindowPos instead, I get that “it is not declared in this scope”. I dont quite understand how the parameters for glRosterPos work though, I have experimented with many, nothing has worked.

In the context_menu function I am also trying to display the results. Right now I have placeholder text, but I am not sure even if we got that to appear in the window, how I would replace sepadd,sepmul,comadd,commul with the corresponding values, because the values are what I need printed.

I am using MinGW through CodeBlocks on Windows. This is my code. Thanks for any help.

#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif

#include <stdlib.h>

//initialize matrices and nodes
static int m =0;
static int n =0;


//calculate separate additions
static int separate_add( int m, int n)
{
    int sepadd=6*n*m;
    return sepadd;
}

//calculate separate multiplications
static int separate_mul( int m, int n)
{
    int sepmul=9*n*m;
    return sepmul;
}

//calculate combined additions
static int combined_add( int m, int n)
{
    int comadd=(6*m)+(6*n);
    return comadd;
}

//calculate combined multiplications
static int combined_mul( int m, int n)
{
    int commul = (9*m)+(9*n);
    return commul;
}

static void idle(void)
{
    glutPostRedisplay();
}

static void resize(int width, int height)
{
    const float ar = (float) width / (float) height;

    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glFrustum(-ar, ar, -1.0, 1.0, 2.0, 100.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity() ;
}

static void display(void)
{
    const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
    const double a = t*90.0;

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glColor3d(0,0,0);
    glutSwapBuffers();

    //Initial text
    glColor3d(0, 0, 0);
        glRasterPos2f(0.5,0.5); //define position on the screen
        char *string = "Right click anywhere on the window to select parameters";

      while(*string){
        glutBitmapCharacter(GLUT_BITMAP_8_BY_13, *string++);
      }
}


void context_menu(int option)
{
    switch(option)
    {
        case 1: m=2; n=10; break;
        case 2: m=2; n=10^3; break;
        case 3: m=2; n=10^6; break;
        case 4: m=4; n=10; break;
        case 5: m=4; n=10^3; break;
        case 6: m=4; n=10^6; break;
        case 7: m=8; n=10; break;
        case 8: m=8; n=10^3; break;
        case 9: m=8; n=10^6; break;
    }

    combined_add(m,n);
    combined_mul(m,n);
    separate_add(m,n);
    separate_mul(m,n);

    glColor3d(0, 0, 0);
        glRasterPos2f(0.7,0.7); //define position on the screen
        char *string = "If transformations are applied separately, sepadd additions performed, sepmul multiplications performed, sepadd+sepmul total calculations. \n If transformations are combined to a single transformation matrix and applied as a total, comadd additions performed, commul multiplications performed, comadd+commul total calculations. \n";

      while(*string){
        glutBitmapCharacter(GLUT_BITMAP_8_BY_13, *string++);
      }
}


int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    glutInitWindowSize(640,480);
    glutInitWindowPosition(200,200);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);

    glutCreateWindow("Transformation Process Comparison");

    //displays initial message
    glutReshapeFunc(resize);
    glutDisplayFunc(display);
    glutIdleFunc(idle);

    glClearColor(1,1,1,1);
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);

    //display parameter menu
    glutCreateMenu(context_menu);
    glutAddMenuEntry("2 Transformations, 10 nodes", 1);
    glutAddMenuEntry("2 Transformations, 10^3 nodes", 2);
    glutAddMenuEntry("2 Transformations, 10^6 nodes", 3);
    glutAddMenuEntry("4 Transformations, 10 nodes", 4);
    glutAddMenuEntry("4 Transformations, 10^3 nodes", 5);
    glutAddMenuEntry("4 Transformations, 10^6 nodes", 6);
    glutAddMenuEntry("8 Transformations, 10 nodes", 7);
    glutAddMenuEntry("8 Transformations, 10^3 nodes", 8);
    glutAddMenuEntry("8 Transformations, 10^6 nodes", 9);
    glutAttachMenu(GLUT_RIGHT_BUTTON);

    glutMainLoop();

    return EXIT_SUCCESS;
}

glWindowPos requires OpenGL 1.4 or later. The <GL/gl.h> header often only declares functions from 1.1. On Windows, you need to use a loader such as GLEW to use functions added after 1.1. This isn’t normally required on Linux but you may need to include <GL/glext.h> explicitly for functions added after 1.1.

The coordinates are transformed by the current model-view and projection matrices, in the same manner as for glVertex.

The transformed coordinates are checked against the clip volume; if they fall outside the volume, the raster position is marked as invalid. That appears to be happening here; you’re using glRasterPos2f which sets the Z coordinate to zero, but you’re setting the projection matrix to a perspective projection with a near distance of 2.0 (a perspective projection requires the near distance to be non-zero).

If you want to specify the position using 2D coordinates, ensure that the matrices are set accordingly, typically setting the projection matrix to an orthographic projection and resetting the model-view matrix to the identity matrix.