Replace GLU with linmath.h in examples

This commit is contained in:
Camilla Berglund
2015-08-09 15:44:20 +02:00
parent 1057bd38cf
commit dd01dd7bef
7 changed files with 86 additions and 72 deletions

View File

@@ -17,9 +17,10 @@
#include <stdlib.h>
#include <math.h>
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#include <linmath.h>
// Maximum delta T to allow for differential calculations
#define MAX_DELTA_T 0.01
@@ -363,6 +364,7 @@ void scroll_callback(GLFWwindow* window, double x, double y)
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
float ratio = 1.f;
mat4x4 projection;
if (height > 0)
ratio = (float) width / (float) height;
@@ -372,8 +374,11 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
// Change to the projection matrix and set our viewing volume
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, ratio, 1.0, 1024.0);
mat4x4_perspective(projection,
60.f * (float) M_PI / 180.f,
ratio,
1.f, 1024.f);
glLoadMatrixf((const GLfloat*) projection);
}