Created
August 13, 2020 11:13
-
-
Save Mulperi/82801b04f45e904661ed3007f1ad3b07 to your computer and use it in GitHub Desktop.
Simple GLFW window init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <GLFW/glfw3.h> | |
#include <stdio.h> | |
/** | |
Compile with MinGW on Windows: | |
mingw32-g++ main.cpp -I C:\libs\prebuilt\glfw-3.3.2.bin.WIN32\include -LC:\libs\prebuilt\glfw-3.3.2.bin.WIN32\lib-mingw -lglfw3 -lGdi32 -lOpengl32 -o main | |
**/ | |
int main() | |
{ | |
glfwInit(); | |
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); | |
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); | |
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); | |
GLFWwindow *window = glfwCreateWindow(512, 512, "glfw test", NULL, NULL); | |
glfwMakeContextCurrent(window); | |
while (!glfwWindowShouldClose(window)) | |
{ | |
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) | |
glfwSetWindowShouldClose(window, true); | |
glClearColor(0.2f, 0.3f, 0.3f, 1.0f); | |
glClear(GL_COLOR_BUFFER_BIT); | |
glfwSwapBuffers(window); | |
glfwPollEvents(); | |
} | |
printf("main\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment