简体   繁体   English

Visual Studio C ++ 2010 express和OpenGL

[英]Visual Studio C++ 2010 express and OpenGL

I want to be able to compile OpenGL4.1 (C/C++) applications from VisualC++ 2010. 我希望能够从VisualC ++ 2010编译OpenGL4.1(C / C ++)应用程序。

After doing a search I only found: http://www.opengl.org/sdk/ and the documentation: (which is fine) http://www.opengl.org/sdk/docs/man4/ 在搜索之后我才发现: http//www.opengl.org/sdk/和文档:(很好) http://www.opengl.org/sdk/docs/man4/

Which is a bit confusing, and I really don't know what to install to get started. 这有点令人困惑,我真的不知道要安装什么来开始。 I can't even find a download link, or what OpenGL projects I should use. 我甚至找不到下载链接,或者我应该使用的OpenGL项目。

You don't need to download anything to use OpenGL. 您无需下载任何内容即可使用OpenGL。 Just add 只需添加

#include <gl/GL.h>
#include <gl/GLU.h>

to the top of your source file. 到源文件的顶部。 And you also need to link the libraries, which in MSVC can be done like this: 而且你还需要链接库,在MSVC中可以这样做:

#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")

With the header files provided with microsoft, you are stuck with version 1.1 of ogl. 使用随Microsoft提供的头文件,你会遇到ogl的1.1版本。 I suggest getting the latest extension headers from the OpenGL website, as well as something like GLEW. 我建议从OpenGL网站获取最新的扩展标题,以及像GLEW这样的东西。 This will give you access to the latest available functions and constants in OpenGL. 这将使您可以访问OpenGL中最新的可用函数和常量。

I believe the windows sdk includes opengl. 我相信windows sdk包含opengl。 Just include windows.h before including GL/gl.h 在包含GL / gl.h之前包含windows.h

http://www.opengl.org/resources/faq/technical/gettingstarted.htm http://www.opengl.org/resources/faq/technical/gettingstarted.htm

Search 2.070 搜索2.070

For Windows you have to use the SDK form the manufacturer of your graphics card. 对于Windows,您必须使用SDK作为显卡制造商。 For Nvidia SDK is available for free download, for registered users. 对于Nvidia SDK,可以免费下载,适用于注册用户。 The OpenGL SDK link that you have shown IMO is only the specification, just like how OpenGL is only the API specification. 您显示IMO的OpenGL SDK链接只是规范,就像OpenGL只是API规范一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM