summaryrefslogtreecommitdiffstats
path: root/progs/tests/tex1d.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-05-21 09:32:38 -0700
committerEric Anholt <[email protected]>2010-05-21 12:20:39 -0700
commit68fc4b415e322f6744299e39864fbc377c6eff74 (patch)
tree4bafffd8b0105174f3c5c0ae327a005be9145990 /progs/tests/tex1d.c
parente4f4489e3fc0b36d72821b55794fb843b2b7fa5f (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/tests/tex1d.c')
-rw-r--r--progs/tests/tex1d.c143
1 files changed, 0 insertions, 143 deletions
diff --git a/progs/tests/tex1d.c b/progs/tests/tex1d.c
deleted file mode 100644
index 7d67451c0da..00000000000
--- a/progs/tests/tex1d.c
+++ /dev/null
@@ -1,143 +0,0 @@
-
-/* Exercise 1D textures
- */
-
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "GL/glew.h"
-#include "GL/glut.h"
-
-static GLuint Window = 0;
-static GLuint TexObj[2];
-static GLfloat Angle = 0.0f;
-
-
-static void draw( void )
-{
- glClear( GL_COLOR_BUFFER_BIT );
-
- glColor3f( 1.0, 1.0, 1.0 );
-
- /* draw first polygon */
- glPushMatrix();
- glTranslatef( -1.0, 0.0, 0.0 );
- glRotatef( Angle, 0.0, 0.0, 1.0 );
- glBindTexture( GL_TEXTURE_1D, TexObj[0] );
- glBegin( GL_POLYGON );
- glTexCoord1f( 0.0 ); glVertex2f( -1.0, -1.0 );
- glTexCoord1f( 1.0 ); glVertex2f( 1.0, -1.0 );
- glTexCoord1f( 1.0 ); glVertex2f( 1.0, 1.0 );
- glTexCoord1f( 0.0 ); glVertex2f( -1.0, 1.0 );
- glEnd();
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-
-/*
-static void idle( void )
-{
- Angle += 2.0;
- glutPostRedisplay();
-}
-*/
-
-
-
-/* change view Angle, exit upon ESC */
-static void key(unsigned char k, int x, int y)
-{
- (void) x;
- (void) y;
- switch (k) {
- case 27:
- exit(0);
- }
-}
-
-
-
-/* new window size or exposure */
-static void reshape( int width, int height )
-{
- glViewport(0, 0, (GLint)width, (GLint)height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/
- glFrustum( -2.0, 2.0, -2.0, 2.0, 6.0, 20.0 );
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -8.0 );
-}
-
-
-static void init( void )
-{
- GLubyte tex[256][3];
- GLint i;
-
-
- glDisable( GL_DITHER );
-
- /* Setup texturing */
- glEnable( GL_TEXTURE_1D );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
-
-
- /* generate texture object IDs */
- glGenTextures( 2, TexObj );
-
- /* setup first texture object */
- glBindTexture( GL_TEXTURE_1D, TexObj[0] );
-
-
- for (i = 0; i < 256; i++) {
- GLfloat f;
-
- /* map 0..255 to -PI .. PI */
- f = ((i / 255.0) - .5) * (3.141592 * 2);
-
- f = sin(f);
-
- /* map -1..1 to 0..255 */
- tex[i][0] = (f+1.0)/2.0 * 255.0;
- tex[i][1] = 0;
- tex[i][2] = 0;
- }
-
- glTexImage1D( GL_TEXTURE_1D, 0, 3, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, tex );
- glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_REPEAT );
-}
-
-
-
-int main( int argc, char *argv[] )
-{
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(300, 300);
- glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
-
- Window = glutCreateWindow("Texture Objects");
- glewInit();
- if (!Window) {
- exit(1);
- }
-
- init();
-
- glutReshapeFunc( reshape );
- glutKeyboardFunc( key );
-/* glutIdleFunc( idle ); */
- glutDisplayFunc( draw );
- glutMainLoop();
- return 0;
-}