Содержание:
Установка GLUT
1. Скачать GLUT со страницы (здесь приведен список адресов для скачивания GLUT под разные платформы).
2. Из полученного архива glutNNN.zip (NNN – номер версии) извлечь все файлы. В результате получим:
3. Скопировать glut.dll и glut32.dll в системную папку Winodws: (папка может называться по-разному, в зависимости от установленной у вас версии Windows).
Важно! В 64-разрядной системе (например, Windows 7) поместите 32-разрядные .dll в папку C:/Windows/SysWOW64 , в которой хранятся 32-разрядные динамические библиотеки. Папка System32 , напротив, предназначена для хранения 64-разрядных .dll , из-за чего иногда возникает путаница.
4. Скопировать glut.h в папку includeGL ( – папку, в которую установлен VC++).
5. Скопировать glut.lib и glut32.lib в папку lib.
Настройка проекта Visual Studio
- Запустить VS и создать новый проект типа "Консольное приложение Win32".
- Указать в дополнительных параметрах проекта "Пустой проект".
- В свойствах проекта (меню "Проект/Свойства") выберите вкладку "Компоновщик" и далее "Ввод".
- В поле "Дополнительные зависимости" (Linker -> Input -> Additional Dependencies) добавьте: opengl32.lib glut32.lib glu32.lib
В исходном файле
В начале исходного файла укажите директиву #include
freeglut
Вместо GLUT можно использовать более современный и свободно распространяемый freeglut.
Скачать freeglut для VC можно здесь. Устанавливается он аналогично. В поле "Дополнительные зависимости" вместо glut32.lib укажите freeglut.lib.
Читайте также
Комментарии
Дмитрий Храмов
Компьютерное моделирование и все, что с ним связано: сбор данных, их анализ, разработка математических моделей, софт для моделирования, визуализации и оформления публикаций. Ну и за жизнь немного.
только начал изучать c++, ну и начал натыкаться на проблемы. Подскажите как установить openGl на vs2017 ? В интернете откопал либо видео 2013 года, либо какой-то glut, даже скачав его с офф в доке не нашел внятного, для себя способа его установить. Также в процессе поиска наткнулся на всякие freeglut, grew и прочее, как я понимаю, библиотеки. Если не затруднит объясните как, куда и откуда устанавливать openGL ? Думаю информация будет полезна и другим чайника 🙂
Open Graphics Library is a cross-language, cross-platform application programming interface for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit, to achieve hardware-accelerated rendering.
To execute your graphics applications written using OpenGL libraries, you can use Visual Studio.
Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs, as well as websites, web apps, web services and mobile apps.
Install Visual Studio Community 2017 using the official installer with the required components as shown in the image below.
Download GLUT header, lib, and dll files from OpenGL. (Mentioned on this page)
Paste glut.h in C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC<14.16.27023>includeGL .
Create the GL folder if not present already. The
Paste glut.lib in C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC<14.16.27023>libx64 .
Paste glut32.lib in C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC<14.16.27023>libx86. The
Paste glut.dll and glut32.dll in C:WindowsSysWOW64 .
Copy glut32.dll to C:WindowsSystem32 also.
Open your Windows Console Application project in Visual Studio , or create a new one:
File > New > Project
Visual C++ > Windows Desktop > Windows Console Application
Go to Project > Properties .
Select All Configuration from Configuration dropdown menu on top left corner.
Select Configuration Properties > C/C++ > Precompiled headers and change Precompiled Header option’s value to Not Using Precompiled Headers .
Select Configuration Properties > Linker > Input . Now right click on Additional Dependencies found on right panel and click Edit.
(Note: Each .lib in new line)
That’s it. You have successfully installed OpenGL. Go on and run your program.
Same installation instructions apply to freeglut files with the header files in the GL folder, lib in the lib folder, and dll in the System32 folder.
You can check your installation by running a simple C++ OpenGL program to draw points on a 2D canvas.
You’ll get the following output:
This website is open source.
Improve this page