Ця галерея з усіма галереями та композиціями всередині її буде вилучена і не може бути відтворена. Ви впевнені?
Виконання...

Ім'я або е-мейл вашого друга, кому буде надіслано це повідомлення:

Будь ласка, відредагуйте текст, як ви бажаєте.

Getting started with OpenGL, 3D and 2d graphics in C++

volodia

Technologies: C++, OpenGL, Visual Studio, GLFW

 

????????? ??????????? ????????????

 

1. ?????????? ??????? ???????? ??? ????? ????????? ?????

2. ?????????? Visual Studio (?? ?? Visual Studio Code)

https://visualstudio.microsoft.com/downloads/

????????? ??????????? Community Version

3. CMAKE Windows x64 Installer – ????????? ??? ?????????? ?? ????? ????? ??? ????????????

https://cmake.org/download/

4. ?????????? ???????? ???? ? ????? ?????????? GLFW (???????? ?????), ?? ????????????

https://www.glfw.org/

?????????, ? ????? C:prgopenglglfw-3.3.8

5. ?????????? glad ????? ? ????? https://glad.dav1d.de/

a) ????????? ?? ??? ????

?) ????????? ????? ?????? ???????????

- language: C / C++

- specification: OpenGL

- profile: core

- gl: version 3.3

?) ????????? ?? ?????? generate

?) ?? ????????, ?? ?’???????, ????????? ?? ???? glad.zip, ?????????? ???? ?? ?????????? ? ????-??? ?????, ????????? C:/prg/opengl/glad

 

 

???????

OpenGL – ??????????, ?? ????????? ??????????? ??? CPU i GPU

GLFW – ??????????, ?? ?????????? ? OpenGL ?? ??????????? ????????, ?? ??????? ???????? ? ???????, ??????, ???????????, ???????? ??????????, ??????? ??? ?????, ???????, ?? ?????.

GLAD – ??????????, ?? ?????????? ?????????? OpenGL ?? ???????? ?????? ???????? ??? ?????? ? ???? ???????????

 

????????? ???????

 

1 ????? ? Visual Studio

2. ???????? ?????? ?????? File → New → Empty project

3. ???? ???? ????? ?? ?????? ?????, ?? ??? ???? ???????????

4. ????????? ??????? — ?? place solution and project in the same directory

??????????: ? ????? ????? ?? ?????? ?????????? ?? ?? ?????, ?? C:UsersKaloAsourcereposDvPlayer ??? ? ?????? ??????? ?? ???? ???? ?????.

 

 

????????? ????????? ?? ??????????? ????



1. ? ???????? ????? ??????? ???????? ????? Libraries

?????? ?????? ???? ????? ???????? ???????? ? ??????? lib ?? include

 

 

 

 

 

?????????? ? ???? ?????????? GLFW ?? ?????????? ????????? ? ??????

 

1. ????????? ???????? Cmake "C:Program FilesCMakebincmake-gui.exe"

2. ?????? ?????, ?? ?? ??????????? flgw, ???????? ???? ????? build

????? ????????? C:prgopenglglfw-3.3.8build

3. ? ???? cmake, ??????? ???? ?????????:

Where is the source code: - ????? ?????, ?? ?????????????, ?????????

C:prgopenglglfw-3.3.8

Where to build the binaries: - ?? ???????????? ????? build, ?????????

C:prgopenglglfw-3.3.8build

4. ????????? ?????? Configure → Finish

????????? ?????

5. ????????? ?????? Generate

6. ????? ??????? CMAKE

7. ??????? ?? ????? ????? ? windows

8. ???????? ???? C:prgopenglglfw-3.3.8buildGLFW.sln ? Visual Studio

9. ? ?????????? ????? (? ???? ??????) ???????? ????? ??????? ?? Solution GLFW, ? ????? ?????? ??????? ???????? ???? ?? ????????? Build Solution — ??????????, ?? ??????????? ??? ?????, ?? ??????? Visual Studio

10. ?????? ???? C:prgopenglglfw-3.3.8buildsrcDebugglfw3.lib ?? ?????????? ???? ?? ?????? ??????? ? ????? lib, ????????? C:UsersKaloAsourcereposDvPlayerLibrarieslib

11. ?????????? ????? C:prgopenglglfw-3.3.8includeGLFW ? ????? C:UsersKaloAsourcereposDvPlayerLibrariesincludeGLFW

12. ?????? ?????, ?? ????????????? glad, ? ??? ???????? ???????? include, ?????, ?????????, ????? C:prgopenglgladinclude ?? ????????? ?? ????? (2 ????? glad, KHR) ? ????? ??????? include, ????????? C:UsersKaloAsourcereposDvPlayerLibrariesinclude. ????? ???????? ???? srcglad.c (????????? C:prgopenglgladsrcglad.c) ?? ????????? ? ??????? ????? ???????, ????????? C:UsersKaloAsourcereposDvPlayer.

 

???????????? ???????

1. ????????? ?????? Properties (?????? ??????? ???? ?? ????? ??????? ? ?????? ?????)

??? ???????? ?? ?????? VC++ Properties. ? ???? Platform ??????? All Platforms


? ???? Include Directories ??????? ???? ????? include, ????? ????????? ?????

C:UsersKaloAsourcereposDvPlayerLibrariesinclude

? ???? Library Directories ??????? ????? C:UsersKaloAsourcereposDvPlayerLibrarieslib

????????? ?????? Apply.

 

? ????? ? ????? Properties ??????? ????? Linker → Input → Additional Dependencies

?? ??????? ???????? 2 ???????:

glfw3.lib

opengl32.lib

????????? ?? ?????? Apply

 

? ?????? ?????? ?????? ?????? ????? ????????? ???? ? ?? ????????? ????? ???? ??????? glad.c (Existing item), ?? ???????? ????? ???? Main.cpp (New Item).

 

 

????????? ?????????? ????????

 

???????? ????????? ???????? ?? ?????????, ??????? ????????? ? ????? ????? ?????? ?? ??????.

 

#include<iostream>

#include<glad/glad.h>

#include<GLFW/glfw3.h>

 

int main()

{

// Initialize GLFW

glfwInit();

 

 

 

// Tell GLFW what version of OpenGL we are using

// In this case we are using OpenGL 3.3

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);

glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);

// Tell GLFW we are using the CORE profile

// So that means we only have the modern functions

glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

 

// Create a GLFWwindow object of 1000 by 800 pixels, naming it "Dv Player"

GLFWwindow* window = glfwCreateWindow(1000, 800, "Dv Player", NULL, NULL);

// Error check if the window fails to create

if (window == NULL)

{

std::cout << "Failed to create GLFW window" << std::endl;

glfwTerminate();

return -1;

}

// Introduce the window into the current context

glfwMakeContextCurrent(window);

 

 

 

//Load GLAD so it configures OpenGL

gladLoadGL();

// Specify the viewport of OpenGL in the Window

// In this case the viewport goes from x = 0, y = 0, to x = 1000, y = 800

glViewport(0, 0, 1000, 800);

 

 

 

// Specify the color of the background

glClearColor(0.96f, 0.86f, 0.0f, 1.0f);

// Clean the back buffer and assign the new color to it

glClear(GL_COLOR_BUFFER_BIT);

// Swap the back buffer with the front buffer

glfwSwapBuffers(window);

 

 

 

// Main while loop

while (!glfwWindowShouldClose(window))

{

// Take care of all GLFW events

glfwPollEvents();

}

 

 

 

// Delete window before ending the program

glfwDestroyWindow(window);

// Terminate GLFW before ending the program

glfwTerminate();

return 0;

 

}

 

????? ?????????? ???? ?????? ?? ?????

https://github.com/VictorGordan/opengl-tutorials/blob/main/YoutubeOpenGL%201%20-%20Create%20Window/Main.cpp

????? ????? ?????????? ???:

https://www.youtube.com/watch?v=45MIykWJ-C4

Автор:   volodia  Версія:  1  Мова: Українська  Переглядів: 0

 Рейтінг:  0 від 0

Коротке посилання: https://www.sponsorschoose.org/a302
Коротке посилання на цю версію: https://www.sponsorschoose.org/n331
Автор - volodia дата: 2023-12-07 04:52:31
Остання зміна - volodia дата: 2023-12-08 21:58:13