Add GL_MODELVIEW_MATRIX as an option to glGetFloatv

This commit is contained in:
Luke Benstead 2019-03-10 12:30:39 +00:00
parent b00b65af54
commit 91c3b66d73
3 changed files with 8 additions and 0 deletions

View File

@ -37,6 +37,10 @@ matrix_t* _glGetProjectionMatrix() {
return (matrix_t*) stack_top(&MATRIX_STACKS[1]); return (matrix_t*) stack_top(&MATRIX_STACKS[1]);
} }
matrix_t* _glGetModelViewMatrix() {
return (matrix_t*) stack_top(&MATRIX_STACKS[0]);
}
void _glInitMatrices() { void _glInitMatrices() {
init_stack(&MATRIX_STACKS[0], sizeof(matrix_t), 32); init_stack(&MATRIX_STACKS[0], sizeof(matrix_t), 32);
init_stack(&MATRIX_STACKS[1], sizeof(matrix_t), 32); init_stack(&MATRIX_STACKS[1], sizeof(matrix_t), 32);

View File

@ -114,6 +114,7 @@ void _glMatrixLoadTexture();
void _glApplyRenderMatrix(); void _glApplyRenderMatrix();
matrix_t* _glGetProjectionMatrix(); matrix_t* _glGetProjectionMatrix();
matrix_t* _glGetModelViewMatrix();
void _glWipeTextureOnFramebuffers(GLuint texture); void _glWipeTextureOnFramebuffers(GLuint texture);
GLubyte _glCheckImmediateModeInactive(const char* func); GLubyte _glCheckImmediateModeInactive(const char* func);

View File

@ -580,6 +580,9 @@ void APIENTRY glGetFloatv(GLenum pname, GLfloat* params) {
case GL_PROJECTION_MATRIX: case GL_PROJECTION_MATRIX:
memcpy(params, _glGetProjectionMatrix(), sizeof(float) * 16); memcpy(params, _glGetProjectionMatrix(), sizeof(float) * 16);
break; break;
case GL_MODELVIEW_MATRIX:
memcpy(params, _glGetModelViewMatrix(), sizeof(float) * 16);
break;
default: default:
_glKosThrowError(GL_INVALID_ENUM, "glGetIntegerv"); _glKosThrowError(GL_INVALID_ENUM, "glGetIntegerv");
_glKosPrintError(); _glKosPrintError();