Basic window
This commit is contained in:
commit
5c61995d1c
39
main.cc
Normal file
39
main.cc
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include <GL/glew.h>
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
|
#define X 16
|
||||||
|
#define Y 16
|
||||||
|
#define GRID_SIZE X*Y
|
||||||
|
|
||||||
|
#define STR_EXPAND(tok) #tok
|
||||||
|
#define STR(tok) STR_EXPAND(tok)
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
if (!glfwInit())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
|
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
|
||||||
|
|
||||||
|
GLFWwindow *w = glfwCreateWindow(800, 800, "game of life", NULL, NULL);
|
||||||
|
if (!w)
|
||||||
|
return -2;
|
||||||
|
|
||||||
|
glfwMakeContextCurrent(w);
|
||||||
|
|
||||||
|
if (glewInit() != GLEW_OK)
|
||||||
|
return -3;
|
||||||
|
|
||||||
|
glfwShowWindow(w);
|
||||||
|
glViewport(0, 0, 800, 800);
|
||||||
|
|
||||||
|
while (!glfwWindowShouldClose(w)) {
|
||||||
|
glfwPollEvents();
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
glfwSwapBuffers(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
glfwTerminate();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user