glx.h question

Started by
2 comments, last by TomasH 19 years, 8 months ago
I am going to start an OpenGL course and I am trying to get a head start on it by compiling this simple program that was in the book:

#include <windows.h>
#include <gl/Gl.h>
#include<gl/glut.h>

void myInit(void)
{

	glClearColor(1.0,1.0,1.0,0.0);
	glColor3f(0.0f,0.0f,0.0f);
	glPointSize(4.0);
	glMatrixMode(GL_PROJECTION);	
	glLoadIdentity();
	gluOrtho2d(0.0,640.0,0.0,480.0);


}

void myDisplay(void)
{
	glClear(GL_COLOR_BUFFER_BIT);
	glBegin(GL_POINTS);
		glVertex2i(100,50);
		glVertex2i(100,130);
		glVertex2i(150,130);
		glEnd()
	glFlush();
}


void main(int argc, char** argv)
{
	glutInit(&argc,argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(640,480);
	glutCreateWindow("my first attempt");
	glutDisplayFunc(myDisplay);
	myInit();
	glutMainLoop();
}

Whenever I try to compile it, I get an error from my gl.h header that says that a header included in it (glx.h) doesn’t exist. This file doesn’t exist anywhere on my computer. Am I just missing this file, or does it not come with the windows openGL or what? Anyway, when I try to comment out the glx.h header, I get a warning and a different error saying: c:\program files\microsoft visual studio\vc98\include\gl\gl.h(2) : warning C4182: #include nesting level is 362 deep; possible infinite recursion c:\program files\microsoft visual studio\vc98\include\gl\gl.h(2) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
-----------------------------Download my real time 3D RPG.
Advertisement
Quote:Whenever I try to compile it, I get an error from my gl.h header that says that a header included in it (glx.h) doesn’t exist. This file doesn’t exist anywhere on my computer. Am I just missing this file, or does it not come with the windows openGL or what?

I don't think glx.h should exist on your computer - it's for X Windows.. Where did you get your gl.h?

Also, you can replace the lines:
#include <windows.h>#include <gl/Gl.h>#include<gl/glut.h>

by simply
#include <GL/glut.h>

It will keep things portable :P
I'm not sure why my gl.h file was like that; maybe I’ve overwritten the original. I’ve got the correct one now, but I’ve got another problem. Where do I get the Glut32.lib and Glut32.dll files?

I can get the ones for win 95 and NT from http://www.opengl.org/resources/libraries/glut.html , but I’ve got XP. Should it be alright with XP?
-----------------------------Download my real time 3D RPG.
You could either get the source and compile it yourself, or download binaries from here.
(I don't know if the ones on opengl.org work on XP - they probably do, but the ones linked above specifically say they work on XP.)

This topic is closed to new replies.

Advertisement