proj home

Files   Classes   Functions   Hierarchy  

main.cpp File Reference

#include <iostream>
#include <GL/glut.h>

Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

void mainInit ()
void mainDisplay ()
void mainReshape (int w, int h)
void mainAnimate ()
int main (int argc, char **argv)

Variables

GLfloat mainspin = 0.0


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 53 of file main.cpp.

References mainAnimate(), mainDisplay(), mainInit(), and mainReshape().

00054 {
00055   glutInit(&argc,argv);
00056   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
00057   glutInitWindowSize(250,250);
00058 
00059   glutCreateWindow(argv[0]);
00060   mainInit();
00061 
00062   glutDisplayFunc(mainDisplay);
00063   glutReshapeFunc(mainReshape);
00064   glutIdleFunc(mainAnimate);
00065 
00066   glutMainLoop();
00067   return 0;
00068 }

void mainAnimate (  ) 

Definition at line 43 of file main.cpp.

References mainspin.

Referenced by main().

00044 {
00045   mainspin += 0.1;
00046   if (mainspin >360.0)
00047     mainspin -= 360.0;
00048 
00049   glutPostRedisplay();
00050 }

void mainDisplay (  ) 

Definition at line 13 of file main.cpp.

References mainspin.

Referenced by main().

00014 {
00015   glClear(GL_COLOR_BUFFER_BIT);
00016   glPushMatrix();
00017 
00018   glRotatef(mainspin,0.0,0.0,1.0);
00019   glColor3f(1.0,0.0,0.0);
00020 
00021   glBegin(GL_TRIANGLES);
00022 
00023   glVertex2f(-0.5,0.0);
00024   glVertex2f(0.0,1.0);
00025   glVertex2f(0.5,0.0);
00026 
00027   glEnd();
00028 
00029   glPopMatrix();
00030   glutSwapBuffers();
00031 }

void mainInit (  ) 

Definition at line 7 of file main.cpp.

Referenced by main().

00008 {
00009   glClearColor(0.0,0.0,0.0,0.0);
00010   glShadeModel(GL_FLAT);
00011 }

void mainReshape ( int  w,
int  h 
)

Definition at line 33 of file main.cpp.

Referenced by main().

00034 {
00035   glViewport(0,0,(GLsizei)w,(GLsizei)h);
00036   glMatrixMode(GL_PROJECTION);
00037   glLoadIdentity();
00038   glOrtho(-1.0,1.0,-1.0,1.0,-1.0,1.0);
00039   glMatrixMode(GL_MODELVIEW);
00040   glLoadIdentity();
00041 }


Variable Documentation

GLfloat mainspin = 0.0

Definition at line 5 of file main.cpp.

Referenced by mainAnimate(), and mainDisplay().


Generated on Fri Mar 4 00:49:32 2011 for Chelton Evans Source by  doxygen 1.5.8