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

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