From 91c3b66d735d5f560d1ef92a7ad1ab3849615659 Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Sun, 10 Mar 2019 12:30:39 +0000 Subject: [PATCH] Add GL_MODELVIEW_MATRIX as an option to glGetFloatv --- GL/matrix.c | 4 ++++ GL/private.h | 1 + GL/state.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/GL/matrix.c b/GL/matrix.c index 5fc2d9e..36f1455 100644 --- a/GL/matrix.c +++ b/GL/matrix.c @@ -37,6 +37,10 @@ matrix_t* _glGetProjectionMatrix() { return (matrix_t*) stack_top(&MATRIX_STACKS[1]); } +matrix_t* _glGetModelViewMatrix() { + return (matrix_t*) stack_top(&MATRIX_STACKS[0]); +} + void _glInitMatrices() { init_stack(&MATRIX_STACKS[0], sizeof(matrix_t), 32); init_stack(&MATRIX_STACKS[1], sizeof(matrix_t), 32); diff --git a/GL/private.h b/GL/private.h index ebae279..e7258fe 100644 --- a/GL/private.h +++ b/GL/private.h @@ -114,6 +114,7 @@ void _glMatrixLoadTexture(); void _glApplyRenderMatrix(); matrix_t* _glGetProjectionMatrix(); +matrix_t* _glGetModelViewMatrix(); void _glWipeTextureOnFramebuffers(GLuint texture); GLubyte _glCheckImmediateModeInactive(const char* func); diff --git a/GL/state.c b/GL/state.c index 7109b87..879c7e0 100644 --- a/GL/state.c +++ b/GL/state.c @@ -580,6 +580,9 @@ void APIENTRY glGetFloatv(GLenum pname, GLfloat* params) { case GL_PROJECTION_MATRIX: memcpy(params, _glGetProjectionMatrix(), sizeof(float) * 16); break; + case GL_MODELVIEW_MATRIX: + memcpy(params, _glGetModelViewMatrix(), sizeof(float) * 16); + break; default: _glKosThrowError(GL_INVALID_ENUM, "glGetIntegerv"); _glKosPrintError();