[vlc-commits] opengl: add documentation related to matrices
Steve Lhomme
git at videolan.org
Thu Nov 10 10:34:36 CET 2016
vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Wed Nov 9 02:37:30 2016 +0100| [782cf22152a148b8de60c80a8d7f20672f897d3b] | committer: Thomas Guillem
opengl: add documentation related to matrices
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>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=782cf22152a148b8de60c80a8d7f20672f897d3b
---
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 26aaec9..134c5df 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -1039,9 +1039,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,
@@ -1051,9 +1053,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,
@@ -1066,6 +1070,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,
@@ -1075,6 +1080,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 f = 3;
More information about the vlc-commits
mailing list