istereo
diff src/tex.c @ 15:32503603eb7d
ah!
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Wed, 07 Sep 2011 09:17:15 +0300 |
parents | b39d8607f4bb |
children | 4c20f10a7183 |
line diff
1.1 --- a/src/tex.c Wed Sep 07 09:03:51 2011 +0300 1.2 +++ b/src/tex.c Wed Sep 07 09:17:15 2011 +0300 1.3 @@ -4,6 +4,7 @@ 1.4 #include <errno.h> 1.5 #include "opengl.h" 1.6 #include "tex.h" 1.7 +#include "config.h" 1.8 1.9 unsigned int load_texture(const char *fname) 1.10 { 1.11 @@ -55,3 +56,18 @@ 1.12 1.13 return tex; 1.14 } 1.15 + 1.16 +void bind_texture(unsigned int tex, int unit) 1.17 +{ 1.18 + glActiveTexture(GL_TEXTURE0 + unit); 1.19 + 1.20 +#ifndef IPHONE 1.21 + if(tex) { 1.22 + glEnable(GL_TEXTURE_2D); 1.23 + } else { 1.24 + glDisable(GL_TEXTURE_2D); 1.25 + } 1.26 +#endif 1.27 + 1.28 + glBindTexture(GL_TEXTURE_2D, tex); 1.29 +}