OpenGL and Windows XP

Can anyone help me with compiling some GLUT code with windows XP…what do I need? and where do I get it?

Cheers.

What compiler are you using?

Originally posted by Nutmegger:
[b]Can anyone help me with compiling some GLUT code with windows XP…what do I need? and where do I get it?

Cheers.[/b]

I am currently using Borland c/c++ compiler 5.5

Originally posted by nexusone:
[b]What compiler are you using?

[/b]

Here is the files you need:

opengl32.lib
gl.h
glu32.lib
glu.h
glut32.lib
glut.h

Check and see if borland came with any of these files, with the .lib library files. They must be made for borland and not Microsoft VC++.

You can try going to the borland site or a user supported site and see if they have the openGL library for the compiler.

They are a few borland users on here, maybe they can tell you what sites to hit.

Originally posted by Nutmegger:
[b]I am currently using Borland c/c++ compiler 5.5

[/b]

The Compiler came with the following files… opengl32.lib, gl.h, glu32.lib, and glu.h. It didn’t come with the glut32.lib or glut.h files… I will seek these out somewhere, however there seems to be a problem with the gl.h file that I DO have. when I tried to compile a simple program that basically draws dots I got the following errors:

C:\Borland\BCC55\Bin>bcc32 star.cpp
Borland C++ 5.5.1 for Win32 Copyright © 1993, 2000 Borland
star.cpp:
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1153: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1154: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1153: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1154: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1155: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1154: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1155: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1156: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1155: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1156: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1157: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1156: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1157: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1158: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1157: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1158: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1159: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1158: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1159: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1160: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1159: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1160: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1161: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1160: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1161: Declaration syntax error
Error E2228 C:\Borland\Bcc55\include\Gl\gl.h 1161: Too many error or warning messages
*** 26 errors in Compile ***

C:\Borland\BCC55\Bin>

I don’t know what’s wrong as the “gl.h” file is definitely in the path specified. Any Ideas?

Originally posted by nexusone:
[b]Here is the files you need:

opengl32.lib
gl.h
glu32.lib
glu.h
glut32.lib
glut.h

Check and see if borland came with any of these files, with the .lib library files. They must be made for borland and not Microsoft VC++.

You can try going to the borland site or a user supported site and see if they have the openGL library for the compiler.

They are a few borland users on here, maybe they can tell you what sites to hit.

[/b]

What is the order of your include files:

#include<GL\gl.h>
#include<GL\glu.h>

Originally posted by Nutmegger:
[b]The Compiler came with the following files… opengl32.lib, gl.h, glu32.lib, and glu.h. It didn’t come with the glut32.lib or glut.h files… I will seek these out somewhere, however there seems to be a problem with the gl.h file that I DO have. when I tried to compile a simple program that basically draws dots I got the following errors:

C:\Borland\BCC55\Bin>bcc32 star.cpp
Borland C++ 5.5.1 for Win32 Copyright © 1993, 2000 Borland
star.cpp:
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1153: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1154: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1153: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1154: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1155: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1154: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1155: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1156: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1155: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1156: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1157: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1156: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1157: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1158: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1157: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1158: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1159: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1158: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1159: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1160: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1159: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1160: Declaration syntax error
Error E2238 C:\Borland\Bcc55\include\Gl\gl.h 1161: Multiple declaration for ‘WINGDIAPI’
Error E2344 C:\Borland\Bcc55\include\Gl\gl.h 1160: Earlier declaration of ‘WINGDIAPI’
Error E2141 C:\Borland\Bcc55\include\Gl\gl.h 1161: Declaration syntax error
Error E2228 C:\Borland\Bcc55\include\Gl\gl.h 1161: Too many error or warning messages
*** 26 errors in Compile ***

C:\Borland\BCC55\Bin>

I don’t know what’s wrong as the “gl.h” file is definitely in the path specified. Any Ideas?

[/b]

Here is the complete code:

#include <Gl\gl.h>
#include <Gl\glut.h>
//<<<<<<<<<<<<<<<<<<<<<<< myInit >>>>>>>>>>>>>>>>>>>>
 void myInit(void)
 {
    glClearColor(1.0,1.0,1.0,0.0);       // set white background color
    glColor3f(0.0f, 0.0f, 0.0f);          // set the drawing color 
 	glPointSize(4.0);		       // a ‘dot’ is 4 by 4 pixels
	glMatrixMode(GL_PROJECTION); 
	glLoadIdentity();
	gluOrtho2D(0.0, 640.0, 0.0, 480.0);
}
//<<<<<<<<<<<<<<<<<<<<<<<< myDisplay >>>>>>>>>>>>>>>>>
void myDisplay(void)
{
	glClear(GL_COLOR_BUFFER_BIT);     // clear the screen 
	glBegin(GL_POINTS);
		glVertex2i(100, 50);         // draw three points
		glVertex2i(100, 130);
		glVertex2i(150, 130);
	glEnd();	
	glFlush();		                 // send all output to display 
}

//<<<<<<<<<<<<<<<<<<<<<<<< main >>>>>>>>>>>>>>>>>>>>>>
int main(int argc, char** argv)
{
	glutInit(&argc, argv);          // initialize the toolkit
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); // set display mode
	glutInitWindowSize(640,480);     // set window size
	glutInitWindowPosition(100, 150); // set window position on screen
	glutCreateWindow("my first attempt"); // open the screen window
	glutDisplayFunc(myDisplay);     // register redraw function
	myInit();                   
	glutMainLoop(); 		     // go into a perpetual loop
	return 0;
}

Originally posted by nexusone:
[b]What is the order of your include files:

#include<GL\gl.h>
#include<GL\glu.h>

[/b]

Try

#include <windows.h>
before gl.h

[This message has been edited by bakery2k (edited 10-15-2002).]

If you are using glut.h, it also has defind inside to include <gl.h> and <glu.h>.

Just have only #include <GL\glut.h> and not gl.h or glu.h

you definitely have to include <windows.h> before using the gl**.h files

Not with all compilers, windows.h is also included in the glut.h header.

I think in MS VC++, you need it, but with others you may not. Like with the compiler I use, not needed.

Originally posted by powerpad:
you definitely have to include <windows.h> before using the gl**.h files

OK it seems to be accepting the gl.h now (when #include <windows.h> ). Cheers for all the help guys. Now I just gotta find the glut32.lib and glut.h!! Shouldn’t be too difficult hopefully. I will no doubt be back before long seeking help on problems with that lol.

Originally posted by nexusone:
[b]Not with all compilers, windows.h is also included in the glut.h header.

I think in MS VC++, you need it, but with others you may not. Like with the compiler I use, not needed.

[/b]

Right I’m Back again, but this time not with any problems…I have some useful info to post!

It seems that now I have the relevent glut files (.lib, .h, & .dll) I get an error if I include the “#include <windows.h>” and if I don’t include windows.h I get an error with including gl.h as before!!! But fortunatly nexusone pointed out that I don’t need to include the gl.h if i am including glut.h, So… the moral of the story is… if using borland c/c++ 5.5 on Win XP, only include glut.h and everything will be alright!

Happy days, my complex program consisting of 3 dots is finally working!

Once again, cheers for all the help guys.

Originally posted by Nutmegger:
[b]OK it seems to be accepting the gl.h now (when #include <windows.h> ). Cheers for all the help guys. Now I just gotta find the glut32.lib and glut.h!! Shouldn’t be too difficult hopefully. I will no doubt be back before long seeking help on problems with that lol.

[/b]