#include "libs.h"
int main()
{
//Initializing
const int WIDTH = 640;
const int HEIGHT = 480;
int frameBufferWidth = 0;
int frameBufferHeight = 0;
//..
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "Game", nullptr, nullptr);
glfwGetFramebufferSize(window, &frameBufferWidth, &frameBufferHeight); // <---- EXCEPTION
glViewport(0, 0, frameBufferWidth, frameBufferHeight);
glfwMakeContextCurrent(window);
//Init GLEW
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK) {
std::cout << "ERROR::MAIN.CPP::GLEW_INIT_FAILED\n";
glfwTerminate();
}
//Main loop
//...
return 0;
}
I have no idea why exception is thrown. I suspect that I am doing something wrong with frameBufferWidth and frameBufferHeight, but I cannot figure out what exactly. Help please! I'm new in OpenGL, so do not judge strictly.
User contributions licensed under CC BY-SA 3.0