Make remaining tests set viewport in render loop

This commit is contained in:
Camilla Löwy
2018-02-04 14:38:25 +01:00
parent c29e4455bb
commit ff6a8891d4
5 changed files with 4 additions and 23 deletions

View File

@@ -92,11 +92,6 @@ static void error_callback(int error, const char* description)
fprintf(stderr, "Error: %s\n", description);
}
static void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
glViewport(0, 0, width, height);
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (action != GLFW_PRESS)
@@ -188,7 +183,6 @@ int main(int argc, char** argv)
swap_tear = (glfwExtensionSupported("WGL_EXT_swap_control_tear") ||
glfwExtensionSupported("GLX_EXT_swap_control_tear"));
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwSetKeyCallback(window, key_callback);
glGenBuffers(1, &vertex_buffer);
@@ -217,9 +211,13 @@ int main(int argc, char** argv)
while (!glfwWindowShouldClose(window))
{
int width, height;
mat4x4 m, p, mvp;
float position = cosf((float) glfwGetTime() * 4.f) * 0.75f;
glfwGetFramebufferSize(window, &width, &height);
glViewport(0, 0, width, height);
glClear(GL_COLOR_BUFFER_BIT);
mat4x4_ortho(p, -1.f, 1.f, -1.f, 1.f, 0.f, 1.f);