diff options
author | jtg <jtg> | 1999-08-19 00:55:39 +0000 |
---|---|---|
committer | jtg <jtg> | 1999-08-19 00:55:39 +0000 |
commit | afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1c (patch) | |
tree | 59d65b4da12fb5379224cf5f6b808fde91523c7f /progs/xdemos/vindex.c | |
parent | f2544d4920ce168bec9cd94d774b7ea5103a3d74 (diff) |
Initial revision
Diffstat (limited to 'progs/xdemos/vindex.c')
-rw-r--r-- | progs/xdemos/vindex.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/progs/xdemos/vindex.c b/progs/xdemos/vindex.c new file mode 100644 index 00000000000..f9e3192f38e --- /dev/null +++ b/progs/xdemos/vindex.c @@ -0,0 +1,66 @@ +/* $Id: vindex.c,v 1.1 1999/08/19 00:55:43 jtg Exp $ */ + +/* + * Test Linux 8-bit SVGA/Mesa color index mode + * + * Compile with: gcc vindex.c -I../include -L../lib -lMesaGL -lX11 -lXext + * -lvga -lm -o vindex + * + * This program is in the public domain. + * Brian Paul, January 1996 + */ + + + +#include <vga.h> +#include "GL/svgamesa.h" +#include "GL/gl.h" + + + +static GLint width = 640, height = 480; + + + +static void display( void ) +{ + int i, j; + int w, h; + + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( 0.0, (GLfloat) width, 0.0, (GLfloat) height, -1.0, 1.0 ); + + glClear( GL_COLOR_BUFFER_BIT ); + + w = width / 16; + h = height / 16; + for (i=0;i<16;i++) { + for (j=0;j<16;j++) { + glIndexi( i*16+j ); + glRecti( i*w, j*h, i*w+w, j*h+h ); + } + } +} + + + +int main( int argc, char *argv[] ) +{ + SVGAMesaContext vmc; + int i; + + vga_init(); + vga_setmode( G640x480x256 ); + + vmc = SVGAMesaCreateContext( GL_FALSE ); + SVGAMesaMakeCurrent( vmc ); + + display(); + sleep(3); + + SVGAMesaDestroyContext( vmc ); + vga_setmode( TEXT ); + return 0; +} |