header files ???
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.
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.
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)
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)
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement