#include <stdio.h>
#include <glut.h>
#include <glTexFont.h>
int winW = 800;
int winH = 600;
float rot[3] = {0,0,0};
char *glExten;
float cube[3] =
{
{-10,-10,10},
{10,-10,10},
{10,10,10},
{-10,10,10},
{-10,-10,-10},
{10,-10,-10},
{10,10,-10},
{-10,10,-10},
{-10,-10,-10},
{-10,-10,10},
{-10,10,10},
{-10,10,-10},
{10,-10,-10},
{10,-10,10},
{10,10,10},
{10,10,-10},
{-10,10,10},
{10,10,10},
{10,10,-10},
{-10,10,-10},
{-10,-10,10},
{10,-10,10},
{10,-10,-10},
{-10,-10,-10}
};
float colors[3] =
{
{1,0,0},
{0,1,0},
{0,0,1},
{1,1,0},
{1,0,1},
{0,1,1}
};
void drawTest (void)
{
int i;
glBegin (GL_QUADS);
for (i = 0; i < 24; i ++)
{
glColor3fv (colors[(i % 7)]);
glVertex3fv (cube[i]);
}
glEnd ();
}
void glutDisplay (void)
{
int size;
float pink = {1, 0, 0.5};
glClearColor (0,0,0,1);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
glTranslatef (0, 0, -50);
glRotatef (rot[0], 1.0, 0.0, 0.0);
glRotatef (rot[1], 0.0, 1.0, 0.0);
glRotatef (rot[2], 0.0, 0.0, 1.0);
drawTest ();
/* There is an unreasonable amount of text below */
fontSize (10);
fontShadow ();
fontShadowColor (0.5, 0.5, 0.5);
fontColor (1,0,0);
fontDrawString (0,winH - 10,"OpenGL Extensions:");
fontSize (10);
fontColor (1,1,1);
fontRegion (10, winH - 10, 10 * 50, 10 * 10);
// Please note that position is ignored with a region established
fontDrawString (-1,-1,glExten);
glutSwapBuffers();
}
void glutIdle (void)
{
int i;
rot[0] += 0.5;
rot[1] -= 0.25;
rot[2] += 1.5;
for (i = 0; i < 3; i ++)
if (rot[i] > 360 | | rot[i] < -360)
rot[i] = 0;
//glutPostRedisplay ();
}
void glInit (void)
{
glEnable (GL_DEPTH_TEST);
glExten = (char ) glGetString(GL_EXTENSIONS);
}
void glutVisible (int state)
{
if (state == GLUT_VISIBLE)
glutIdleFunc (glutIdle);
}
void glutKeyboard (unsigned char key, int x, int y)
{
switch (key)
{
case ‘q’:
case ‘Q’:
case 27:
exit (1);
break;
}
}
void main (int argc, char argv)
{
glutInit(&argc,argv);
glutGameModeString(“800x600:16@60”);
glutEnterGameMode();
//glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
//glutInitWindowSize(winW,winH);
//glutCreateWindow(“Font Test”);
glutDisplayFunc(glutDisplay);
//glutReshapeFunc(glutResize);
glutIdleFunc(glutIdle);
glutVisibilityFunc(glutVisible);
glutKeyboardFunc(glutKeyboard);
glInit();
// gray scale font
fontLoad (“fontGray.tga”);
glutFullScreen();
glutMainLoop();
}
If i replace the call to drawTest() with this, it then crashes with that error.
This isn’t the only place where it will crash with that for no reason that I can see, but this is just the latest one. I’m Thinking that the library could be buggered up.