[vlc-devel] [PATCH 04/16] opengl: add documentation related to matrices
Thomas Guillem
thomas at gllm.fr
Wed Nov 9 18:32:58 CET 2016
From: Steve Lhomme <robux4 at videolabs.io>
These added comments should make it easier to reason about the different
matrices used to do viewpoint related calculations.
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
---
modules/video_output/opengl.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index d4f5662..5246422 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -1057,9 +1057,11 @@ static void getViewMatrix(GLfloat matrix[static 16]) {
memcpy(matrix, m, sizeof(m));
}
+/* rotation around the Y axis */
static void getYRotMatrix(float teta, GLfloat matrix[static 16]) {
const GLfloat m[] = {
+ /* x y z w */
cos(teta), 0.0f, -sin(teta), 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
sin(teta), 0.0f, cos(teta), 0.0f,
@@ -1069,9 +1071,11 @@ static void getYRotMatrix(float teta, GLfloat matrix[static 16]) {
memcpy(matrix, m, sizeof(m));
}
+/* rotation around the X axis */
static void getXRotMatrix(float phi, GLfloat matrix[static 16]) {
const GLfloat m[] = {
+ /* x y z w */
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, cos(phi), sin(phi), 0.0f,
0.0f, -sin(phi), cos(phi), 0.0f,
@@ -1084,6 +1088,7 @@ static void getXRotMatrix(float phi, GLfloat matrix[static 16]) {
static void getZoomMatrix(float zoom, GLfloat matrix[static 16]) {
const GLfloat m[] = {
+ /* x y z w */
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
@@ -1093,6 +1098,7 @@ static void getZoomMatrix(float zoom, GLfloat matrix[static 16]) {
memcpy(matrix, m, sizeof(m));
}
+/* perspective matrix see https://www.opengl.org/sdk/docs/man2/xhtml/gluPerspective.xml */
static void getProjectionMatrix(float sar, GLfloat matrix[static 16]) {
float zFar = 1000;
--
2.9.3
More information about the vlc-devel
mailing list