更新时间:2023-11-12 10:26:04
首先,您需要有一个视频卡,并检查它与OpenGL和驱动程序更新的工作。我使用此链接中的测试,
检查Visual Studio 2008是否正确安装并在计算机中创建以下路径也很重要:
C:\Program Files \Microsoft SDKs\Windows\v6.0A
现在我们可以按照安装步骤:
1.- 从 ://www.opengl.org/resources/libraries/glut/glut_downloads.phprel =nofollow> https://www.opengl.org/resources/libraries/glut/glut_downloads.php ,解压缩并按照以下说明复制文件:
2.-创建一个空的C ++ Win32应用程序:
3.-添加一个新的C ++源文件:
4.- 链接到OpenGL库(重要步骤):
5.-下载此示例代码。
6.-还需要在Visual Studio中设置路径:
工具 - >选项 - > VC ++目录 - >包含文件:
C:\Program Files \Microsoft SDKs \Windows \\ v6.0A \包括
在配置属性→链接器→附加库
目录:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
As I had many problems setting Visual Studio 2008 for using OpenGL I will ask this question that can be useful to some people:
Which are the steps to follow in order to use OpenGL with C++ in Visual Studio 2008?
First of all you need to have a video card and check that it works with OpenGL and the drivers are updated. I used the test in this link to check it.
It is also important to check that Visual Studio 2008 is correctly installed and that the following path is created in your computer:
C:\Program Files\Microsoft SDKs\Windows\v6.0A
Now we can follow the installation steps:
1.- Download GLUT from https://www.opengl.org/resources/libraries/glut/glut_downloads.php, unzip and copy the files as instructed below:
2.- Create an empty C++ Win32 application:
3.- Add a new C++ source file:
4.- Link to the OpenGL libraries (important step):
5.- Download this sample code.
6.- It is also necessary to set the paths in Visual Studio:
In Tools -> Options -> VC++ Directories -> Include Files:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
In Configuration Properties → Linker → Additional Library Directories:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib