blob: f0900b6ed6d78389668b86014523e7e16bd8dd45 [file] [log] [blame]
jtgafb833d1999-08-19 00:55:39 +00001/* $Id: vtest.c,v 1.1 1999/08/19 00:55:43 jtg Exp $ */
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 * This program is in the public domain.
10 * Brian Paul, January 1996
11 */
12
13
14
15#include <vga.h>
16#include "GL/svgamesa.h"
17#include "GL/gl.h"
18
19
20SVGAMesaContext vmc;
21
22
23
24void setup( void )
25{
26 vga_init();
27
28 vga_setmode(G800x600x32K);
29/* gl_setcontextvga(G800x600x32K);*/
30
31 vmc = SVGAMesaCreateContext( GL_FALSE ); /* single buffered */
32 SVGAMesaMakeCurrent( vmc );
33}
34
35
36void test( void )
37{
38 glMatrixMode(GL_PROJECTION);
39 glLoadIdentity();
40 glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
41 glMatrixMode(GL_MODELVIEW);
42
43 glClear( GL_COLOR_BUFFER_BIT );
44
45 glBegin( GL_LINES );
46 glColor3f( 1.0, 0.0, 0.0 );
47 glVertex2f( -0.5, 0.5 );
48 glVertex2f( 0.5, 0.5 );
49 glColor3f( 0.0, 1.0, 0.0 );
50 glVertex2f( -0.5, 0.25 );
51 glVertex2f( 0.5, 0.25 );
52 glColor3f( 0.0, 0.0, 1.0 );
53 glVertex2f( -0.5, 0.0 );
54 glVertex2f( 0.5, 0.0 );
55 glEnd();
56
57 glBegin( GL_POLYGON );
58 glColor3f( 1.0, 0.0, 0.0 );
59 glVertex2f( 0.0, 0.7 );
60 glColor3f( 0.0, 1.0, 0.0 );
61 glVertex2f( -0.5, -0.5 );
62 glColor3f( 0.0, 0.0, 1.0 );
63 glVertex2f( 0.5, -0.5 );
64 glEnd();
65
66 sleep(3);
67}
68
69void end( void )
70{
71 SVGAMesaDestroyContext( vmc );
72
73 vga_setmode( TEXT );
74}
75
76
77int main( int argc, char *argv[] )
78{
79 setup();
80 test();
81 end();
82 return 0;
83}