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.0KB

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