diff options
author | Eric Anholt <[email protected]> | 2010-05-21 09:32:38 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-05-21 12:20:39 -0700 |
commit | 68fc4b415e322f6744299e39864fbc377c6eff74 (patch) | |
tree | 4bafffd8b0105174f3c5c0ae327a005be9145990 /progs/trivial/tex-quads.c | |
parent | e4f4489e3fc0b36d72821b55794fb843b2b7fa5f (diff) |
Remove demos that have moved to git+ssh://git.freedesktop.org/git/mesa/demos.
The remaining programs are ones I've had difficulty finding a build
environment for to make the build system or are unit tests that should
probably live next to their code instead. Hopefully people can bring
over the build for remaining pieces they care about.
Diffstat (limited to 'progs/trivial/tex-quads.c')
-rw-r--r-- | progs/trivial/tex-quads.c | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/progs/trivial/tex-quads.c b/progs/trivial/tex-quads.c deleted file mode 100644 index 626e178b873..00000000000 --- a/progs/trivial/tex-quads.c +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Draw a series of quads, each with a different texture. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - -#define NUM_TEX 10 - -static GLint Win = 0; -static GLuint Tex[NUM_TEX]; - - -static void Init(void) -{ - int i; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fflush(stderr); - - glGenTextures(NUM_TEX, Tex); - - for (i = 0; i < NUM_TEX; i++) { - glBindTexture(GL_TEXTURE_2D, Tex[i]); - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } -} - - -static void Reshape(int width, int height) -{ - float ar = (float) width / height; - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-ar, ar, -1.0, 1.0, -1.0, 1.0); - glMatrixMode(GL_MODELVIEW); -} - - -static void Key(unsigned char key, int x, int y) -{ - if (key == 27) { - glDeleteTextures(NUM_TEX, Tex); - glutDestroyWindow(Win); - exit(1); - } - glutPostRedisplay(); -} - - -static void Draw(void) -{ - GLubyte tex[16][16][4]; - int t, i, j; - - for (t = 0; t < NUM_TEX; t++) { - - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - if (i < t) { - /* red row */ - tex[i][j][0] = 255; - tex[i][j][1] = 0; - tex[i][j][2] = 0; - tex[i][j][3] = 255; - } - else if ((i + j) & 1) { - tex[i][j][0] = 128; - tex[i][j][1] = 128; - tex[i][j][2] = 128; - tex[i][j][3] = 255; - } - else { - tex[i][j][0] = 255; - tex[i][j][1] = 255; - tex[i][j][2] = 255; - tex[i][j][3] = 255; - } - } - } - - glBindTexture(GL_TEXTURE_2D, Tex[t]); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, - GL_RGBA, GL_UNSIGNED_BYTE, tex); - } - - glEnable(GL_TEXTURE_2D); - - glClear(GL_COLOR_BUFFER_BIT); - - for (i = 0; i < NUM_TEX; i++) { - - glBindTexture(GL_TEXTURE_2D, Tex[i]); - - glPushMatrix(); - glTranslatef(-4.0 + i, 0, 0); - glScalef(0.5, 0.5, 1.0); - - glBegin(GL_QUADS); - glTexCoord2f(1,0); - glVertex3f( 0.9, -0.9, 0.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, 0.0); - glTexCoord2f(0,1); - glVertex3f(-0.9, 0.9, 0.0); - glTexCoord2f(0,0); - glVertex3f(-0.9, -0.9, 0.0); - glEnd(); - - glPopMatrix(); - } - - - glutSwapBuffers(); -} - - -int main(int argc, char **argv) -{ - glutInit(&argc, argv); - glutInitWindowSize(900, 200); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - Win = glutCreateWindow(*argv); - if (!Win) { - exit(1); - } - glewInit(); - Init(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} |