This repository was archived by the owner on May 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
70 lines (55 loc) · 1.51 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// main.c
// assetkit_render
//
// Created by Recep Aslantas on 9/30/16.
// Copyright © 2016 Recep Aslantas. All rights reserved.
//
#include <stdlib.h>
#include <stdio.h>
#include <GLFW/glfw3.h>
#include "assetkit_test.h"
void (glfw_resized)(GLFWwindow* window,int w,int h) {
resize();
}
void
glfw_errCallback(int err, const char *desc) {
printf("GLFW %s", desc);
}
int
main(int argc, const char * argv[]) {
glfwSetErrorCallback(glfw_errCallback);
if (!glfwInit()) {
printf("GLFW err: glfwInit");
return -1;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_SAMPLES, 4);
GLFWwindow *window = glfwCreateWindow(800, // vidmod->width,
600, // vidmod->height,
"Ogl1",
NULL, // monitor,
NULL);
if (!window) {
printf("GLFW " "window");
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glfwSetWindowSizeCallback(window, glfw_resized);
init();
while (!glfwWindowShouldClose(window)) {
glfwPollEvents();
glfwSwapBuffers(window);
render();
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
dealloc();
glfwSetWindowShouldClose(window, 1);
}
}
// glfwTerminate();
return 0;
}