GLFW window
This commit is contained in:
31
src/main.c
Normal file
31
src/main.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "main.h"
|
||||
|
||||
int main() {
|
||||
if(!glfwInit()) {
|
||||
printf("Faild to initalize GLFW\n");
|
||||
return -1;
|
||||
}
|
||||
glfwSetErrorCallback(&glfwError);
|
||||
glfwWindowHint(GLFW_SAMPLES, 4);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
GLFWwindow *window;
|
||||
window = glfwCreateWindow(1920, 1080, "Minecraft-Clone", NULL, NULL);
|
||||
if(window == NULL) {
|
||||
printf("Failed to open GLFW window.\n");
|
||||
glfwTerminate();
|
||||
return -1;
|
||||
}
|
||||
glfwMakeContextCurrent(window);
|
||||
glewExperimental = true;
|
||||
}
|
||||
void glfwError(int id, const char* description) {
|
||||
printf("Glfw Error: %s\n", description);
|
||||
}
|
||||
4
src/main.h
Normal file
4
src/main.h
Normal file
@ -0,0 +1,4 @@
|
||||
#ifndef main_h
|
||||
#define main_h
|
||||
void glfwError(int id, const char* description);
|
||||
#endif
|
||||
Reference in New Issue
Block a user