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();