forked from cntools/rawdraw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ogltest.c
55 lines (44 loc) · 850 Bytes
/
ogltest.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "CNFGFunctions.h"
#include <GL/gl.h>
#include <stdio.h>
#include <stdlib.h>
void HandleKey( int keycode, int bDown )
{
printf( "Key: %d %d\n", keycode, bDown );
}
void HandleButton( int x, int y, int button, int bDown )
{
}
void HandleMotion( int x, int y, int mask )
{
}
void HandleDestroy()
{
exit(10);
}
int main()
{
short w, h;
int frameno = 0;
CNFGSetup( "Test", 100, 100 );
while(1)
{
CNFGClearFrame();
CNFGHandleInput();
glRotatef( frameno/100.0, 0, 0, 1);
glColor4f( 0, 0, .5, 1 );
glBegin( GL_TRIANGLES );
glVertex3f( -40, -40, 0 );
glVertex3f( 40, 0, 0 );
glVertex3f( 0, 40, 0 );
glEnd();
char stmp[100];
CNFGColor( 0xFFFFFF );
sprintf( stmp, "%d\n", frameno );
CNFGPenX = 10; CNFGPenY = 10;
CNFGDrawText( stmp, 3 );
CNFGTackPixel( 100, 100 );
CNFGSwapBuffers();
frameno++;
}
}