home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / mesa-1.2.8 / demos / vtest.c < prev    next >
C/C++ Source or Header  |  1996-05-27  |  1KB  |  83 lines

  1. /* vtest.c */
  2.  
  3. /*
  4.  * Test SVGA/Mesa interface in 32K color mode.
  5.  *
  6.  * Compile with:  gcc vtest.c -I../include -L../lib -lMesaGL -lX11 -lXext
  7.  *   -lvga -lm -o vtest
  8.  *
  9.  * Brian Paul, January 1996
  10.  */
  11.  
  12.  
  13.  
  14. #include <vga.h>
  15. #include "svgamesa.h"
  16. #include "GL/gl.h"
  17.  
  18.  
  19. SVGAMesaContext vmc;
  20.  
  21.  
  22.  
  23. void setup( void )
  24. {
  25.    vga_init();
  26.  
  27.    vga_setmode(G800x600x32K);
  28. /*   gl_setcontextvga(G800x600x32K);*/
  29.  
  30.    vmc = SVGAMesaCreateContext();
  31.    SVGAMesaMakeCurrent( vmc );
  32. }
  33.  
  34.  
  35. void test( void )
  36. {
  37.    glMatrixMode(GL_PROJECTION);
  38.    glLoadIdentity();
  39.    glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
  40.    glMatrixMode(GL_MODELVIEW);
  41.  
  42.    glClear( GL_COLOR_BUFFER_BIT );
  43.  
  44.    glBegin( GL_LINES );
  45.    glColor3f( 1.0, 0.0, 0.0 );
  46.    glVertex2f( -0.5, 0.5 );
  47.    glVertex2f(  0.5, 0.5 );
  48.    glColor3f( 0.0, 1.0, 0.0 );
  49.    glVertex2f( -0.5, 0.25 );
  50.    glVertex2f(  0.5, 0.25 );
  51.    glColor3f( 0.0, 0.0, 1.0 );
  52.    glVertex2f( -0.5, 0.0 );
  53.    glVertex2f(  0.5, 0.0 );
  54.    glEnd();
  55.  
  56.    glBegin( GL_POLYGON );
  57.    glColor3f( 1.0, 0.0, 0.0 );
  58.    glVertex2f( 0.0, 0.7 );
  59.    glColor3f( 0.0, 1.0, 0.0 );
  60.    glVertex2f( -0.5, -0.5 );
  61.    glColor3f( 0.0, 0.0, 1.0 );
  62.    glVertex2f(  0.5, -0.5 );
  63.    glEnd();
  64.  
  65.    sleep(3);
  66. }
  67.  
  68. void end( void )
  69. {
  70.    SVGAMesaDestroyContext( vmc );
  71.  
  72.    vga_setmode( TEXT );
  73. }
  74.  
  75.  
  76. int main( int argc, char *argv[] )
  77. {
  78.    setup();
  79.    test();
  80.    end();
  81.    return 0;
  82. }
  83.