dungeon_crawler

annotate prototype/src/opengl.cc @ 11:e5567ddbf2ef

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