1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
| #include "libs.h"
#include "CustomFunctions.hpp"
int main()
{
/*****************************************************************
GLFW Init
******************************************************************/
if (!glfwInit())
{
std::cout << "GLFW Init ERROR\n";
return -1;
}
const int WINDOW_WIDTH = 640;
const int WINDOW_HEIGHT = 480;
int framebufferWidth = 0;
int framebufferHeight = 0;
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
GLFWwindow* window
= glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "OpenGL", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
glfwSetFramebufferSizeCallback(window, framebufferResizeCallback);
//glfwGetFramebufferSize(window, &framebufferWidth, &framebufferHeight);
//glViewport(0, 0, framebufferWidth, framebufferHeight);
// 현재 컨텍스트에서 윈도우 생성
glfwMakeContextCurrent(window);
// 프레임 진행 속도 설정
glfwSwapInterval(1);
/*****************************************************************
GLEW Init
******************************************************************/
// glewInit은 rendering context를 만들고 난 이후에 해야 함
if (glewInit() != GLEW_OK)
{
std::cout << "GLEW INIT ERROR\n";
glfwTerminate();
}
// 간단히 GLEW 버전 확인
std::cout << glGetString(GL_VERSION) << std::endl;
/*****************************************************************
Objects
******************************************************************/
/*****************************************************************
Main Loop
******************************************************************/
while (!glfwWindowShouldClose(window))
{
// Update Input
glfwPollEvents();
// Update
// Clear
glClearColor(0.f, 0.f, 0.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
// Draw
// End Draw
glfwSwapBuffers(window);
glFlush();
}
// End of Program
glfwTerminate();
return 0;
}
|