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>
#include <GL/glut.h>

#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)

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

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

    glLoadIdentity() ;

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


    //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";

        glutBitmapCharacter(GLUT_BITMAP_8_BY_13, *string++);

void context_menu(int 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;


    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";

        glutBitmapCharacter(GLUT_BITMAP_8_BY_13, *string++);

int main(int argc, char *argv[])
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);

    glutCreateWindow("Transformation Process Comparison");

    //displays initial message


    //display parameter 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);


    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.