diff options
Diffstat (limited to 'progs/demos')
-rw-r--r-- | progs/demos/copypix.c | 22 | ||||
-rw-r--r-- | progs/demos/cubemap.c | 5 | ||||
-rw-r--r-- | progs/demos/lodbias.c | 4 |
3 files changed, 31 insertions, 0 deletions
diff --git a/progs/demos/copypix.c b/progs/demos/copypix.c index 51435acfa0f..a13339ea62f 100644 --- a/progs/demos/copypix.c +++ b/progs/demos/copypix.c @@ -26,6 +26,7 @@ static int Scissor = 0; static float Xzoom, Yzoom; static GLboolean DrawFront = GL_FALSE; static GLboolean Dither = GL_TRUE; +static GLboolean Invert = GL_FALSE; static void Reset( void ) @@ -59,6 +60,15 @@ static void Display( void ) if (Scissor) glEnable(GL_SCISSOR_TEST); + if (Invert) { + glPixelTransferf(GL_RED_SCALE, -1.0); + glPixelTransferf(GL_GREEN_SCALE, -1.0); + glPixelTransferf(GL_BLUE_SCALE, -1.0); + glPixelTransferf(GL_RED_BIAS, 1.0); + glPixelTransferf(GL_GREEN_BIAS, 1.0); + glPixelTransferf(GL_BLUE_BIAS, 1.0); + } + /* draw copy */ glPixelZoom(Xzoom, Yzoom); glWindowPos2iARB(Xpos, Ypos); @@ -67,6 +77,15 @@ static void Display( void ) glDisable(GL_SCISSOR_TEST); + if (Invert) { + glPixelTransferf(GL_RED_SCALE, 1.0); + glPixelTransferf(GL_GREEN_SCALE, 1.0); + glPixelTransferf(GL_BLUE_SCALE, 1.0); + glPixelTransferf(GL_RED_BIAS, 0.0); + glPixelTransferf(GL_GREEN_BIAS, 0.0); + glPixelTransferf(GL_BLUE_BIAS, 0.0); + } + if (DrawFront) glFinish(); else @@ -105,6 +124,9 @@ static void Key( unsigned char key, int x, int y ) else glDisable(GL_DITHER); break; + case 'i': + Invert = !Invert; + break; case 's': Scissor = !Scissor; break; diff --git a/progs/demos/cubemap.c b/progs/demos/cubemap.c index 0df5ff09c33..015d50d86be 100644 --- a/progs/demos/cubemap.c +++ b/progs/demos/cubemap.c @@ -58,6 +58,7 @@ static GLint ClampIndex = 0; static GLboolean supportFBO = GL_FALSE; static GLboolean supportSeamless = GL_FALSE; static GLboolean seamless = GL_FALSE; +static GLuint TexObj = 0; static struct { @@ -543,6 +544,10 @@ static void init( GLboolean useImageFiles ) printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER)); + + glGenTextures(1, &TexObj); + glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, TexObj); + if (useImageFiles) { load_envmaps(); } diff --git a/progs/demos/lodbias.c b/progs/demos/lodbias.c index 30b1ed13d5f..8d39bd605a7 100644 --- a/progs/demos/lodbias.c +++ b/progs/demos/lodbias.c @@ -43,6 +43,7 @@ static GLboolean Anim = GL_TRUE; static GLint Bias = 0, BiasStepSign = +1; /* ints avoid fp precision problem */ static GLint BiasMin = -400, BiasMax = 400; static int win = 0; +static GLuint TexObj = 0; static void @@ -214,6 +215,9 @@ static void Init( void ) glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glGenTextures(1, &TexObj); + glBindTexture(GL_TEXTURE_2D, TexObj); + if (glutExtensionSupported("GL_SGIS_generate_mipmap")) { /* test auto mipmap generation */ GLint width, height, i; |