c++ - 如何将 OpenGL 库链接到 NetBeans 7.1 中的项目

标签 c++ opengl netbeans

我有一本教授 OpenGL 3.0 基础知识的书,但它要求我将头文件合并到我的 C++ 项目中。现在,我正在使用 Netbeans 7.1,但我不知道去哪里查看或做什么。这是书中的文字:

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.

最佳答案

您可以从这里获取适当的头文件 (.h):http://www.opengl.org/registry/

然后你需要找到你的编译器安装的文件夹;在那里你应该找到 include 文件夹。

现在在 include 文件夹..../include/GL 中创建一个 GL 文件夹,并将标题粘贴到其中。 然后你可以使用:

#include<GL/your_header>

您的书使用 freeGlut 或 openGlut 来运行示例,还是手动完成上下文创建和扩展加载? 如果是这样,如果没有合适的辅助库(如 GLUT、GLEW 或 SDL),对于新手程序员来说可能会变得非常具有挑战性。

关于c++ - 如何将 OpenGL 库链接到 NetBeans 7.1 中的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9516134/

相关文章:

java - 如何将资源目录而不是单个文件包含到编译类路径中?

c++ - 动态字符串数组构造函数和 null 返回

c++ - EDSDK 3.4.0 on OS X 10.12.1 with Rebel t6i : `kEdsObjectEvent_DirItemCreated` event is not received for up to 30 seconds after photo is taken

c++ - 影响程序输出的 3D 纹理大小不会抛出错误

Python 与 Netbeans 6.5

java - inconsolata 和 netbeans

c++ - 如何使用 QStringList 过滤 QSortFilterProxyModel?

c++ - 从 riscv-gnu-toolchain 生成的 s 文件不运行 RISCV 模拟器

c++ - 你怎么 "free"一个纹理单元?

opengl - 将值列表传递给片段着色器