add init draw and frame buffer size callback
This commit is contained in:
parent
41c7355817
commit
bbec4f6a26
19
src/main.c
19
src/main.c
|
@ -2,6 +2,18 @@
|
|||
#include <GLFW/glfw3.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void init(void) {
|
||||
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
|
||||
}
|
||||
|
||||
void draw(void) {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
glfwInit();
|
||||
|
@ -15,9 +27,16 @@ int main(int argc, char const *argv[])
|
|||
glfwTerminate();
|
||||
return 1;
|
||||
}
|
||||
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
glewInit();
|
||||
|
||||
init();
|
||||
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
draw();
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue