proj home

Files   Classes   Functions   Hierarchy  

test07 Class Reference

gobjContainer is a generic graphics object container which can write itself out as a display list More...

#include <test07.h>

Inheritance diagram for test07:
Collaboration diagram for test07:

List of all members.

Public Member Functions

 test07 (int &argc, char **&argv, uintc mode, uintc x, uintc y, string const &title)
void keyboard (unsigned char key, int x, int y)
 Derived classes define keyboard.
void display ()
 Derived classes define display.
void eval ()
 Generally responsible for graphics initialization.


Detailed Description

gobjContainer is a generic graphics object container which can write itself out as a display list

OpenGL's display list functions can be tested. A gobjContainer can be written out as static geometry by a call to displaylistcreatenew(). This simplifies the use of display lists as the client only needs to create it and draw as any other gobj.

The example shows how parameter driven geometry like the glutWireTorus function need not be computed everytime but used to build variable geometry that is then compiled.

Definition at line 25 of file test07.h.


Constructor & Destructor Documentation

test07::test07 ( int &  argc,
char **&  argv,
uintc  mode,
uintc  x,
uintc  y,
string const &  title 
)

Definition at line 21 of file test07.cpp.

00029   : myglutgui(argc,argv,mode,x,y,title), xGraphics(true)
00030 {
00031   globalSet();
00032 }


Member Function Documentation

void test07::display (  )  [virtual]

Derived classes define display.

Implements myglutgui.

Definition at line 34 of file test07.cpp.

References gobjContainer::draw(), and glerrordisplay().

00035 {
00036   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00037 
00038   xGraphics.draw();
00039 
00040 //cout << "drawing" << endl;
00041 //cout << SHOW(xGraphics.vg.size()) << endl;
00042 
00043   glerrordisplay();
00044   glutSwapBuffers();
00045 }

void test07::eval (  )  [virtual]

Generally responsible for graphics initialization.

Not useful for classes with multiple initializations and hence this function is not abstract.

Reimplemented from myglutgui.

Definition at line 107 of file test07.cpp.

References gobjContainer::set().

00108 {
00109   OpenGLinitialisation();
00110   
00111   glEnable(GL_DEPTH_TEST);
00112   glEnable(GL_CULL_FACE);
00113 
00114   //zpr::init();
00115 
00116   xGraphics.set();
00117 
00118   f1();
00119 
00120   glutPostRedisplay();
00121 }

void test07::keyboard ( unsigned char  key,
int  x,
int  y 
) [virtual]

Derived classes define keyboard.

Reimplemented from myglutgui.

Definition at line 47 of file test07.cpp.

References gobjContainer::displaylistcreatenew(), gobjglutWireTorus::innerRadius, gobjContainer::nuke(), gobjContainer::push(), and gobjglutWireTorus::rings.

00048 {
00049   switch (key)
00050   {
00051     case 27:
00052       exit(0);
00053       break;
00054 
00055     case 'i':
00056       cout << "Enter the inner radius:  ";
00057       cin >> gtorus->innerRadius;
00058       xGraphics.nuke();
00059       xGraphics.push( gcomp->displaylistcreatenew(1) );
00060       break;
00061 
00062     case 'r':
00063       cout << "Enter the number of rings:  ";
00064       cin >> gtorus->rings;
00065       xGraphics.nuke();
00066       xGraphics.push( gcomp->displaylistcreatenew(1) );
00067       break;
00068 
00069 
00070   }
00071 
00072   glutPostRedisplay();
00073 }


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:50:19 2011 for Chelton Evans Source by  doxygen 1.5.8