if (!glewInit())
throw std::exception("GLEW Init error!");
if (!glfwInit())
throw std::exception("GLFW Init error!");
this->SetResizeble(false);
this->window = glfwCreateWindow(WIN_MIN_SIZE_W, WIN_MIN_SIZE_H, "Engine", nullptr, nullptr);
glfwMakeContextCurrent(this->window);
RenderSys().Init();
EventSys().Init();
Shader* shader = load_shader("Shaders/main.glslv", "Shaders/main.glslf");
if (shader == nullptr)
throw std::exception("Fail to load shader!");
#include <iostream>
#include <GLFW/glfw3.h>
int main()
{
try
{
if (!glfwInit())
{
throw std::exception("GLFW Init error!");
}
GLFWwindow* window = glfwCreateWindow(800, 600, "Engine", nullptr, nullptr);
glfwMakeContextCurrent(window);
while (!glfwWindowShouldClose(window))
{
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
} catch (const std::exception& e)
{
std::cout << "Error: " << e.what() << std::endl;
}
}