Город МОСКОВСКИЙ
00:14:50

How to download and install OPENGL in VISUAL STUDIO

Аватар
Установка и подключение
Просмотры:
32
Дата загрузки:
16.10.2024 01:12
Длительность:
00:14:50
Категория:
Обучение

Описание

IN this video we are going to set up opengl steps given below
first download open gl librarys by given link ::: https://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
after download extract it on your desktop \
and then follow the steps
1. Download GLUT header, lib, and dll files from OpenGL. (Mentioned on this page)


2. Paste glut.h in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.16.27023}\include\GL.
Create the GL folder if not present already. The {version} may differ on your system.


3. Paste glut.lib in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.16.27023}\lib\x64.


Paste glut32.lib in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.16.27023}\lib\x86. The {version} may differ on your system.

4. Paste glut.dll and glut32.dll in C:\Windows\SysWOW64.


Copy glut32.dll to C:\Windows\System32 also.

5. Open your Windows Console Application project in Visual Studio, or create a new one:

File \ New \ Project

Visual C++ \ Windows Desktop \ Windows Console Application

6. 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.

Now type:
opengl32.lib
glu32.lib
glut32.lib
(Note: Each .lib in new line)
7. That’s it. You have successfully installed OpenGL. Go on and run your program.

sample code
#include "GL/glut.h"
void display() {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 0.0, 0.0);

glBegin(GL_POINTS);

glVertex2f(10.0, 10.0);
glVertex2f(150.0, 80.0);
glVertex2f(100.0, 20.0);
glVertex2f(200.0, 100.0);
glEnd();
glFlush();
}

void myinit() {
glClearColor(1.0, 1.0, 1.0, 1.0);
glColor3f(1.0, 0.0, 0.0);
glPointSize(5.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 499.0, 0.0, 499.0);
}

void main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500, 500);
glutInitWindowPosition(0, 0);
glutCreateWindow("Points");
glutDisplayFunc(display);

myinit();
glutMainLoop();
}

Рекомендуемые видео