intravenous

diff src/opengl.cc @ 3:94d4c60af435

some progress
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 22 Apr 2012 03:35:18 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/opengl.cc	Sun Apr 22 03:35:18 2012 +0300
     1.3 @@ -0,0 +1,39 @@
     1.4 +#include "opengl.h"
     1.5 +
     1.6 +void load_gl_matrix(const Matrix4x4 &mat)
     1.7 +{
     1.8 +#ifdef SINGLE_PRECISION_MATH
     1.9 +	if(glLoadTransposeMatrixfARB) {
    1.10 +		glLoadTransposeMatrixfARB((float*)&mat);
    1.11 +	} else {
    1.12 +		Matrix4x4 tmat = mat.transposed();
    1.13 +		glLoadMatrixf((float*)&tmat);
    1.14 +	}
    1.15 +#else
    1.16 +	if(glLoadTransposeMatrixdARB) {
    1.17 +		glLoadTransposeMatrixdARB((double*)&mat);
    1.18 +	} else {
    1.19 +		Matrix4x4 tmat = mat.transposed();
    1.20 +		glLoadMatrixd((double*)&tmat);
    1.21 +	}
    1.22 +#endif
    1.23 +}
    1.24 +
    1.25 +void mult_gl_matrix(const Matrix4x4 &mat)
    1.26 +{
    1.27 +#ifdef SINGLE_PRECISION_MATH
    1.28 +	if(glMultTransposeMatrixfARB) {
    1.29 +		glMultTransposeMatrixfARB((float*)&mat);
    1.30 +	} else {
    1.31 +		Matrix4x4 tmat = mat.transposed();
    1.32 +		glMultMatrixf((float*)&tmat);
    1.33 +	}
    1.34 +#else
    1.35 +	if(glMultTransposeMatrixdARB) {
    1.36 +		glMultTransposeMatrixdARB((double*)&mat);
    1.37 +	} else {
    1.38 +		Matrix4x4 tmat = mat.transposed();
    1.39 +		glMultMatrixd((double*)&tmat);
    1.40 +	}
    1.41 +#endif
    1.42 +}