Add ImGui and refactor
This commit is contained in:
parent
b416f8da27
commit
4261ce59f7
20
src/main.cpp
20
src/main.cpp
|
@ -2,6 +2,9 @@
|
|||
#include <GLFW/glfw3.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <imgui_impl_opengl3.h>
|
||||
|
||||
#include "scene.h"
|
||||
|
||||
int main(){
|
||||
|
@ -24,13 +27,26 @@ int main(){
|
|||
return -1;
|
||||
}
|
||||
|
||||
Scene::Init();
|
||||
|
||||
//Init ImGui
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
||||
ImGui_ImplOpenGL3_Init("#version 150");
|
||||
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
Scene::Idle();
|
||||
glfwSwapBuffers(window);
|
||||
Scene::Display(window);
|
||||
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
// Cleanup ImGui
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
ImGui_ImplGlfw_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
return 0;
|
||||
|
|
|
@ -12,10 +12,16 @@ void Scene::DrawGUI(GLFWwindow* window){
|
|||
}
|
||||
|
||||
void Scene::Display(GLFWwindow* window) {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glfwSwapBuffers(window);
|
||||
}
|
||||
|
||||
void Scene::Idle() {
|
||||
}
|
||||
|
||||
void Scene::Init() {
|
||||
glewInit();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_CULL_FACE);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue