-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenGLLearning.cpp
More file actions
65 lines (45 loc) · 1.47 KB
/
OpenGLLearning.cpp
File metadata and controls
65 lines (45 loc) · 1.47 KB
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
#pragma once
#include <iostream>
#include <filesystem>
#include "include/Core/Scene.h"
//#include "Bullet/btBulletDynamicsCommon.h"
#include "include/Core/LoadTextures.h"
int main(int argc, char* argv[]) {
int width = 1920;
int height = 1080;
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
GLFWwindow* _window = glfwCreateWindow(width, height, "New layout", NULL, NULL);
Renderer _renderer;
// Check for Valid Context
if (_window == nullptr) {
fprintf(stderr, "Failed to Create OpenGL Context");
return false;
}
glfwMakeContextCurrent(_window);
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
{
std::cout << "Failed to init. OpenGL Context" << std::endl;
return false;
}
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
(void)io;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
ImGui::StyleColorsDark();
ImGui_ImplGlfw_InitForOpenGL(_window, true);
ImGui_ImplOpenGL3_Init("#version 330");
fprintf(stderr, "OpenGL %s\n", glGetString(GL_VERSION));
glfwSetInputMode(_window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
Scene newScene(*_window, &_renderer);
newScene.initScene();
newScene.loadResources();
newScene.run();
glfwTerminate();
return EXIT_SUCCESS;
}