gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:33:07 25 4
gpt4 key购买 nike

我有一本教授 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com