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.

vtest.c 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* $Id: vtest.c,v 1.1 1999/08/19 00:55:43 jtg Exp $ */
  2. /*
  3. * Test SVGA/Mesa interface in 32K color mode.
  4. *
  5. * Compile with: gcc vtest.c -I../include -L../lib -lMesaGL -lX11 -lXext
  6. * -lvga -lm -o vtest
  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. SVGAMesaContext vmc;
  15. void setup( void )
  16. {
  17. vga_init();
  18. vga_setmode(G800x600x32K);
  19. /* gl_setcontextvga(G800x600x32K);*/
  20. vmc = SVGAMesaCreateContext( GL_FALSE ); /* single buffered */
  21. SVGAMesaMakeCurrent( vmc );
  22. }
  23. void test( void )
  24. {
  25. glMatrixMode(GL_PROJECTION);
  26. glLoadIdentity();
  27. glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
  28. glMatrixMode(GL_MODELVIEW);
  29. glClear( GL_COLOR_BUFFER_BIT );
  30. glBegin( GL_LINES );
  31. glColor3f( 1.0, 0.0, 0.0 );
  32. glVertex2f( -0.5, 0.5 );
  33. glVertex2f( 0.5, 0.5 );
  34. glColor3f( 0.0, 1.0, 0.0 );
  35. glVertex2f( -0.5, 0.25 );
  36. glVertex2f( 0.5, 0.25 );
  37. glColor3f( 0.0, 0.0, 1.0 );
  38. glVertex2f( -0.5, 0.0 );
  39. glVertex2f( 0.5, 0.0 );
  40. glEnd();
  41. glBegin( GL_POLYGON );
  42. glColor3f( 1.0, 0.0, 0.0 );
  43. glVertex2f( 0.0, 0.7 );
  44. glColor3f( 0.0, 1.0, 0.0 );
  45. glVertex2f( -0.5, -0.5 );
  46. glColor3f( 0.0, 0.0, 1.0 );
  47. glVertex2f( 0.5, -0.5 );
  48. glEnd();
  49. sleep(3);
  50. }
  51. void end( void )
  52. {
  53. SVGAMesaDestroyContext( vmc );
  54. vga_setmode( TEXT );
  55. }
  56. int main( int argc, char *argv[] )
  57. {
  58. setup();
  59. test();
  60. end();
  61. return 0;
  62. }