oculus1

annotate src/opengl.cc @ 27:9f783284a503

changed some FBO calls which I accidentally used the OpenGL 3.2 form instead of the more compatible one
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 26 Oct 2013 03:54:35 +0300
parents 3265970a7315
children
rev   line source
nuclear@8 1 #include "opengl.h"
nuclear@9 2 #include <vmath/vmath.h>
nuclear@8 3
nuclear@9 4 void load_matrix(const Matrix4x4 &m)
nuclear@8 5 {
nuclear@9 6 #ifdef SINGLE_PRECISION_MATH
nuclear@9 7 if(glLoadTransposeMatrixfARB) {
nuclear@9 8 glLoadTransposeMatrixfARB((float*)&m);
nuclear@9 9 } else {
nuclear@9 10 Matrix4x4 tmat = m.transposed();
nuclear@9 11 glLoadMatrixf((float*)&tmat);
nuclear@9 12 }
nuclear@9 13 #else
nuclear@9 14 if(glLoadTransposeMatrixdARB) {
nuclear@9 15 glLoadTransposeMatrixdARB((double*)&m);
nuclear@9 16 } else {
nuclear@9 17 Matrix4x4 tmat = m.transposed();
nuclear@9 18 glLoadMatrixd((double*)&tmat);
nuclear@9 19 }
nuclear@9 20 #endif
nuclear@9 21 }
nuclear@9 22
nuclear@9 23 void mult_matrix(const Matrix4x4 &m)
nuclear@9 24 {
nuclear@9 25 #ifdef SINGLE_PRECISION_MATH
nuclear@9 26 if(glMultTransposeMatrixfARB) {
nuclear@9 27 glMultTransposeMatrixfARB((float*)&m);
nuclear@9 28 } else {
nuclear@9 29 Matrix4x4 tmat = m.transposed();
nuclear@9 30 glMultMatrixf((float*)&tmat);
nuclear@9 31 }
nuclear@9 32 #else
nuclear@9 33 if(glMultTransposeMatrixdARB) {
nuclear@9 34 glMultTransposeMatrixdARB((double*)&m);
nuclear@9 35 } else {
nuclear@9 36 Matrix4x4 tmat = m.transposed();
nuclear@9 37 glMultMatrixd((double*)&tmat);
nuclear@9 38 }
nuclear@8 39 #endif
nuclear@8 40 }
nuclear@8 41
nuclear@8 42 const char *strglerr(int err)
nuclear@8 43 {
nuclear@8 44 static const char *errnames[] = {
nuclear@8 45 "GL_INVALID_ENUM",
nuclear@8 46 "GL_INVALID_VALUE",
nuclear@8 47 "GL_INVALID_OPERATION",
nuclear@8 48 "GL_STACK_OVERFLOW",
nuclear@8 49 "GL_STACK_UNDERFLOW",
nuclear@8 50 "GL_OUT_OF_MEMORY",
nuclear@8 51 "GL_INVALID_FRAMEBUFFER_OPERATION"
nuclear@8 52 };
nuclear@8 53
nuclear@8 54 if(!err) {
nuclear@8 55 return "GL_NO_ERROR";
nuclear@8 56 }
nuclear@8 57 if(err < GL_INVALID_ENUM || err > GL_OUT_OF_MEMORY) {
nuclear@8 58 return "<invalid gl error>";
nuclear@8 59 }
nuclear@8 60 return errnames[err - GL_INVALID_ENUM];
nuclear@8 61 }