Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/doc/program_examples/openGL/gl_test.c @ 4190

Last change on this file since 4190 was 1803, checked in by patrick, 21 years ago

doc update

File size: 797 bytes
Line 
1
2
3#include <stdlib.h>
4#include <stdio.h>
5
6#include <GL/glut.h>
7
8
9
10
11void display( void ) {
12
13  glClear( GL_COLOR_BUFFER_BIT );
14  glColor3f( 1.0, 1.0, 1.0 );
15  glBegin( GL_POLYGON );
16  glVertex3f( 0.25, 0.25, 0.0 );
17  glVertex3f( 0.75, 0.25, 0.0 );
18  glVertex3f( 0.75, 0.75, 0.0 );
19  glVertex3f( 0.25, 0.75, 0.0 );
20  glEnd();
21
22  glFlush();
23}
24
25
26
27void init( void ) {
28
29  glClearColor( 0.0, 0.0, 0.0, 0.0 );
30  glMatrixMode( GL_PROJECTION );
31  glLoadIdentity();
32  glOrtho( 0.0, 1.0, 0.0, 1.0, -1.0, 1.0 );
33 
34}
35
36
37
38
39int main( int argc, char** argv ) {
40 
41  glutInit( &argc, argv );
42  glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB );
43  glutInitWindowSize( 250, 250 );
44  glutInitWindowPosition( 100, 100);
45  glutCreateWindow( "hello" );
46  init();
47  glutDisplayFunc( display );
48  glutMainLoop();
49
50  return 0;
51}
Note: See TracBrowser for help on using the repository browser.