stratgame
view gfx/src/opengl.cc @ 5:2e38715de41b
terrain
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 27 May 2012 07:00:48 +0300 |
parents | |
children |
line source
1 #include "opengl.h"
3 void load_gl_matrix(const Matrix4x4 &mat)
4 {
5 #ifdef SINGLE_PRECISION_MATH
6 if(glLoadTransposeMatrixfARB) {
7 glLoadTransposeMatrixfARB((float*)&mat);
8 } else {
9 Matrix4x4 tmat = mat.transposed();
10 glLoadMatrixf((float*)&tmat);
11 }
12 #else
13 if(glLoadTransposeMatrixdARB) {
14 glLoadTransposeMatrixdARB((double*)&mat);
15 } else {
16 Matrix4x4 tmat = mat.transposed();
17 glLoadMatrixd((double*)&tmat);
18 }
19 #endif
20 }
22 void mult_gl_matrix(const Matrix4x4 &mat)
23 {
24 #ifdef SINGLE_PRECISION_MATH
25 if(glMultTransposeMatrixfARB) {
26 glMultTransposeMatrixfARB((float*)&mat);
27 } else {
28 Matrix4x4 tmat = mat.transposed();
29 glMultMatrixf((float*)&tmat);
30 }
31 #else
32 if(glMultTransposeMatrixdARB) {
33 glMultTransposeMatrixdARB((double*)&mat);
34 } else {
35 Matrix4x4 tmat = mat.transposed();
36 glMultMatrixd((double*)&tmat);
37 }
38 #endif
39 }