dungeon_crawler
view prototype/src/opengl.cc @ 14:67ae9fcb802c
loading normal map
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 19 Aug 2012 06:30:18 +0300 |
parents | |
children | 5c41e6fcb300 |
line source
1 #include "opengl.h"
2 #include "vmath.h"
4 void load_matrix(const Matrix4x4 &m)
5 {
6 #ifdef SINGLE_PRECISION_MATH
7 if(glLoadTransposeMatrixfARB) {
8 glLoadTransposeMatrixfARB((float*)&m);
9 } else {
10 Matrix4x4 tmat = m.transposed();
11 glLoadMatrixf((float*)&tmat);
12 }
13 #else
14 if(glLoadTransposeMatrixdARB) {
15 glLoadTransposeMatrixdARB((double*)&m);
16 } else {
17 Matrix4x4 tmat = m.transposed();
18 glLoadMatrixd((double*)&tmat);
19 }
20 #endif
21 }
23 void mult_matrix(const Matrix4x4 &m)
24 {
25 #ifdef SINGLE_PRECISION_MATH
26 if(glMultTransposeMatrixfARB) {
27 glMultTransposeMatrixfARB((float*)&m);
28 } else {
29 Matrix4x4 tmat = m.transposed();
30 glMultMatrixf((float*)&tmat);
31 }
32 #else
33 if(glMultTransposeMatrixdARB) {
34 glMultTransposeMatrixdARB((double*)&m);
35 } else {
36 Matrix4x4 tmat = m.transposed();
37 glMultMatrixd((double*)&tmat);
38 }
39 #endif
40 }