dungeon_crawler

diff prototype/src/opengl.cc @ 7:8fb37db44fd8

first person motion
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 17 Aug 2012 14:29:37 +0300
parents
children 5c41e6fcb300
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/prototype/src/opengl.cc	Fri Aug 17 14:29:37 2012 +0300
     1.3 @@ -0,0 +1,40 @@
     1.4 +#include "opengl.h"
     1.5 +#include "vmath.h"
     1.6 +
     1.7 +void load_matrix(const Matrix4x4 &m)
     1.8 +{
     1.9 +#ifdef SINGLE_PRECISION_MATH
    1.10 +	if(glLoadTransposeMatrixfARB) {
    1.11 +		glLoadTransposeMatrixfARB((float*)&m);
    1.12 +	} else {
    1.13 +		Matrix4x4 tmat = m.transposed();
    1.14 +		glLoadMatrixf((float*)&tmat);
    1.15 +	}
    1.16 +#else
    1.17 +	if(glLoadTransposeMatrixdARB) {
    1.18 +		glLoadTransposeMatrixdARB((double*)&m);
    1.19 +	} else {
    1.20 +		Matrix4x4 tmat = m.transposed();
    1.21 +		glLoadMatrixd((double*)&tmat);
    1.22 +	}
    1.23 +#endif
    1.24 +}
    1.25 +
    1.26 +void mult_matrix(const Matrix4x4 &m)
    1.27 +{
    1.28 +#ifdef SINGLE_PRECISION_MATH
    1.29 +	if(glMultTransposeMatrixfARB) {
    1.30 +		glMultTransposeMatrixfARB((float*)&m);
    1.31 +	} else {
    1.32 +		Matrix4x4 tmat = m.transposed();
    1.33 +		glMultMatrixf((float*)&tmat);
    1.34 +	}
    1.35 +#else
    1.36 +	if(glMultTransposeMatrixdARB) {
    1.37 +		glMultTransposeMatrixdARB((double*)&m);
    1.38 +	} else {
    1.39 +		Matrix4x4 tmat = m.transposed();
    1.40 +		glMultMatrixd((double*)&tmat);
    1.41 +	}
    1.42 +#endif
    1.43 +}