GLFWWindow constructor
Implementation
GLFWWindow(int width, int height, String title)
: super(width, height, title) {
if (glfwInit() != GLFW_TRUE) {
glfwTerminate();
throw 'Couldn\'t initialize GLFW.';
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // For mac
_windowHandle = glfwCreateWindow(width, height, title, nullptr, nullptr);
if (_windowHandle == nullptr) {
glfwTerminate();
throw 'Couldn\'t create GLFW window.';
}
_lastWidth = width;
_lastHeight = height;
glfwMakeContextCurrent(_windowHandle);
gladLoadGLLoader(glfwGetProcAddress);
graphics = OGLGraphics();
graphics.changeBack(width, height);
_sizeBuff = malloc<Int32>(2);
_heightPointer = Pointer<Int32>.fromAddress(_sizeBuff.address + 4);
}