Sign in to follow this  
sandblasted

header files ???

Recommended Posts

sandblasted    100
Hi guys , I am new to openGL coding. I am really confused bout the different header files that i need to include in the code body. like the following header files #include <gl\gl.h> #include <gl\glu.h> #include <gl\glaux.h> #include <gl\glut.h> What do they mean. I mean I dont even know which one to use when. I am using glut applications in my codeblocks IDE. For my first code (first example from redbook, which just displayed a rectangle) I used <gl/glut.h> and <windows.h> and it worked fine. But I used these header files out of guessing. When are the <gl\gl.h> or <gl\glaux.h> or <gl\glu.h> are used? And why is a backslash ("\") used between <gl\glut.h>. why cant I use simply write <glut.h>? Someone please explain in easy words. I am pretty confused and scared about the whole openGL stuff. thanks.

Share this post


Link to post
Share on other sites
Kasya    207
Gl\Gl.h is for default OpenGL Functions like glVertex3f, glBegin...
Gl\GLU.h is for GLU library functions like gluPerspective,...
GL\GLUT.h is for GLUT library functions like glutInit,...

if you see you need the functions with the following prefixes then include the header, otherwise its not needed.

Quote:
And why is a backslash ("\") used between <gl\glut.h>. why cant I use simply write <glut.h>?


because they are included in directory like that (just example):

for example: "C:\Program Files\OpenGL\include" is included by the compiler and inside this directory there is a directory "C:\Program Files\OpenGL\include\GL". That's why you <GL\GL.h> (where tags show that its a compiler include)

Share this post


Link to post
Share on other sites
Zahlman    1682
Quote:
Original post by sandblasted
When are the <gl\gl.h> or <gl\glaux.h> or <gl\glu.h> are used?


When you need the things that they contain. Each one provides different stuff related to GL.

It tells you in the red book what each of them provides. If you don't understand how it's written there, you probably need to learn more about programming in general before you are really ready to do things with OpenGL.

Quote:
And why is a backslash ("\") used between <gl\glut.h>. why cant I use simply write <glut.h>?


Because you are providing file names for the header files, and those header files are in a sub-folder of where all the header files are kept.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this