DutchLearner
DutchLearner

Reputation: 335

How to link OpenGL libraries to project in NetBeans 7.1

I have a book that teaches the basics of OpenGL 3.0 but it asks me to incorporate header files into my C++ project. Now, I'm using Netbeans 7.1 and I have no idea where to look or what to do. This is the text from the book:

When compiling OpenGL applications, several libraries need to be linked and header files included. The header files are conventionally stored in an include directory called GL. The following header files may be included in a project depending on the platform and features required:

gl.h - This is the primary header file that defines most of the OpenGL functions.
glu.h - The header for the OpenGL Utility library.
glext.h - The OpenGL extensions header file. This header file is regularly updated and available on opengl.org. It includes constants and definitions for the most recent OpenGL extensions.
wglext.h - The Windows extensions header file. The same as glext.h but for Windows-only extensions.
glxext.h - The GLX extensions header file contains constants for GLX extensions.

All OpenGL applications must link to at least opengl32.lib on Windows, or libGL.a on Linux. If the application makes use of the OpenGL Utility library, then glu32.lib (on Windows) or libGLU.a (on Linux) must also be linked.

Upvotes: 2

Views: 5288

Answers (2)

Mandark
Mandark

Reputation: 828

You can take the appropriate header (.h) files from here: http://www.opengl.org/registry/

Then you need to locate the folder where your compiler is installed; there you should locate the include folder.

Now create a GL folder inside the include folder ..../include/GL and paste your headers inside. Then you can use:

#include<GL/your_header>

Does your book use freeGlut or openGlut to run examples or is the context creation and extension loading being done manually? If so, it can get quite challenging for a novice programmer without the appropriate helper libraries like GLUT,GLEW or SDL.

Upvotes: 2

Neil Flodin
Neil Flodin

Reputation: 588

If you can't find the libraries, you could try just linking with SDL. It includes support for opengl, and has its own header to use. The code examples may have to be modified a little bit, but it's worth it. Also, might I ask, which compiler are you using? (Visual C++, GCC, Xcode, etc.)

-Neil

Upvotes: -1

Related Questions