# HG changeset patch # User John Tsiombikas # Date 1315376235 -10800 # Node ID 32503603eb7d73b9cb72606a10adec9f28632f69 # Parent b39d8607f4bbd59afae3bc4995a692e649af854b ah! diff -r b39d8607f4bb -r 32503603eb7d src/config.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/config.h Wed Sep 07 09:17:15 2011 +0300 @@ -0,0 +1,8 @@ +#ifndef CONFIG_H_ +#define CONFIG_H_ + +#if defined(__IPHONE_3_0) || defined(__IPHONE_3_2) || defined(__IPHONE_4_0) +#define IPHONE +#endif + +#endif /* CONFIG_H_ */ diff -r b39d8607f4bb -r 32503603eb7d src/opengl.h --- a/src/opengl.h Wed Sep 07 09:03:51 2011 +0300 +++ b/src/opengl.h Wed Sep 07 09:17:15 2011 +0300 @@ -1,4 +1,9 @@ -#if defined(__IPHONE_3_0) || defined(__IPHONE_3_2) || defined(__IPHONE_4_0) +#ifndef OPENGL_H_ +#define OPENGL_H_ + +#include "config.h" + +#ifdef IPHONE #include #else @@ -10,4 +15,6 @@ #include #endif /* __APPLE__ */ -#endif +#endif /* IPHONE */ + +#endif /* OPENGL_H_ */ diff -r b39d8607f4bb -r 32503603eb7d src/respath.c --- a/src/respath.c Wed Sep 07 09:03:51 2011 +0300 +++ b/src/respath.c Wed Sep 07 09:17:15 2011 +0300 @@ -4,9 +4,9 @@ #include #include #include "respath.h" +#include "config.h" -#if defined(__IPHONE_3_0) || defined(__IPHONE_3_2) || defined(__IPHONE_4_0) -#define IPHONE +#ifdef IPHONE #include #endif diff -r b39d8607f4bb -r 32503603eb7d src/tex.c --- a/src/tex.c Wed Sep 07 09:03:51 2011 +0300 +++ b/src/tex.c Wed Sep 07 09:17:15 2011 +0300 @@ -4,6 +4,7 @@ #include #include "opengl.h" #include "tex.h" +#include "config.h" unsigned int load_texture(const char *fname) { @@ -55,3 +56,18 @@ return tex; } + +void bind_texture(unsigned int tex, int unit) +{ + glActiveTexture(GL_TEXTURE0 + unit); + +#ifndef IPHONE + if(tex) { + glEnable(GL_TEXTURE_2D); + } else { + glDisable(GL_TEXTURE_2D); + } +#endif + + glBindTexture(GL_TEXTURE_2D, tex); +}