summaryrefslogtreecommitdiffstats
path: root/progs
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2009-06-20 00:24:03 +0200
committerRoland Scheidegger <[email protected]>2009-06-20 00:28:38 +0200
commit7a5c5b9af3699f55b5c5be170a791f1ac2e05457 (patch)
treeed000f6297794f7c4e643d254d28af542770a498 /progs
parentdd26899ca39111e0866afed9df94bfb1618dd363 (diff)
demos: make cubemap work without EXT_fbo support
use SGIS_generate_mipmap if EXT_fbo support (for manual mipmap generation) is not available.
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/cubemap.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/progs/demos/cubemap.c b/progs/demos/cubemap.c
index 26db42aed5e..1f9f2905759 100644
--- a/progs/demos/cubemap.c
+++ b/progs/demos/cubemap.c
@@ -52,6 +52,7 @@ static GLboolean NoClear = GL_FALSE;
static GLint FrameParity = 0;
static GLenum FilterIndex = 0;
static GLint ClampIndex = 0;
+static GLboolean supportFBO = GL_FALSE;
static struct {
@@ -403,6 +404,10 @@ static void init_checkers( void )
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ if (!supportFBO)
+ glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
+
+
/* make colored checkerboard cube faces */
for (f = 0; f < 6; f++) {
for (i = 0; i < CUBE_TEX_SIZE; i++) {
@@ -426,7 +431,8 @@ static void init_checkers( void )
GL_BGRA, GL_UNSIGNED_BYTE, image);
}
- glGenerateMipmapEXT(GL_TEXTURE_CUBE_MAP_ARB);
+ if (supportFBO)
+ glGenerateMipmapEXT(GL_TEXTURE_CUBE_MAP_ARB);
}
@@ -503,10 +509,13 @@ static void init( GLboolean useImageFiles )
exit(0);
}
- /* Needed for glGenerateMipmapEXT
+ /* Needed for glGenerateMipmapEXT / auto mipmapping
*/
- if (!strstr(exten, "GL_EXT_framebuffer_object")) {
- printf("Sorry, this demo requires GL_EXT_framebuffer_object\n");
+ if (strstr(exten, "GL_EXT_framebuffer_object")) {
+ supportFBO = GL_TRUE;
+ }
+ else if (!strstr(exten, "GL_SGIS_generate_mipmap")) {
+ printf("Sorry, this demo requires GL_EXT_framebuffer_object or GL_SGIS_generate_mipmap\n");
exit(0);
}
}