Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vindex.c 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* $Id: vindex.c,v 1.1 1999/08/19 00:55:43 jtg Exp $ */
  2. /*
  3. * Test Linux 8-bit SVGA/Mesa color index mode
  4. *
  5. * Compile with: gcc vindex.c -I../include -L../lib -lMesaGL -lX11 -lXext
  6. * -lvga -lm -o vindex
  7. *
  8. * This program is in the public domain.
  9. * Brian Paul, January 1996
  10. */
  11. #include <vga.h>
  12. #include "GL/svgamesa.h"
  13. #include "GL/gl.h"
  14. static GLint width = 640, height = 480;
  15. static void display( void )
  16. {
  17. int i, j;
  18. int w, h;
  19. glViewport( 0, 0, width, height );
  20. glMatrixMode( GL_PROJECTION );
  21. glLoadIdentity();
  22. glOrtho( 0.0, (GLfloat) width, 0.0, (GLfloat) height, -1.0, 1.0 );
  23. glClear( GL_COLOR_BUFFER_BIT );
  24. w = width / 16;
  25. h = height / 16;
  26. for (i=0;i<16;i++) {
  27. for (j=0;j<16;j++) {
  28. glIndexi( i*16+j );
  29. glRecti( i*w, j*h, i*w+w, j*h+h );
  30. }
  31. }
  32. }
  33. int main( int argc, char *argv[] )
  34. {
  35. SVGAMesaContext vmc;
  36. int i;
  37. vga_init();
  38. vga_setmode( G640x480x256 );
  39. vmc = SVGAMesaCreateContext( GL_FALSE );
  40. SVGAMesaMakeCurrent( vmc );
  41. display();
  42. sleep(3);
  43. SVGAMesaDestroyContext( vmc );
  44. vga_setmode( TEXT );
  45. return 0;
  46. }