1 #ifndef EXAMPLES_HELLO_WORLD_GLES_MATRIX_H
2 #define EXAMPLES_HELLO_WORLD_GLES_MATRIX_H
4 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
10 * Implements simple matrix manipulation functions.
13 //-----------------------------------------------------------------------------
14 #define _USE_MATH_DEFINES 1
17 #include <GLES2/gl2.h>
19 typedef GLfloat Matrix_t
[16];
21 /// Since GLES2 doesn't have all the nifty matrix transform functions that GL
22 /// has, we emulate some of them here for the sake of sanity from:
23 /// http://www.opengl.org/wiki/GluPerspective_code
24 void glhFrustumf2(Matrix_t mat
,
32 void glhPerspectivef2(Matrix_t mat
,
33 GLfloat fovyInDegrees
,
38 void identity_matrix(Matrix_t mat
);
39 void multiply_matrix(const Matrix_t a
, const Matrix_t b
, Matrix_t mat
);
40 void rotate_matrix(GLfloat x_deg
, GLfloat y_deg
, GLfloat z_deg
, Matrix_t mat
);
41 void translate_matrix(GLfloat x
, GLfloat y
, GLfloat z
, Matrix_t mat
);
43 #endif // EXAMPLES_HELLO_WORLD_GLES_MATRIX_H