|
Nokia N97 SDK Example Applications Guide |
#include <SimpleCubePbuffer.h>
Inheritance diagram for CSimpleCubePbuffer:

Definition at line 33 of file SimpleCubePbuffer.h.
Public Member Functions |
|
| virtual | ~CSimpleCubePbuffer () |
| void | AppInit (void) |
| void | AppExit (void) |
| void | DrawBox (GLfloat aSizeX, GLfloat aSizeY, GLfloat aSizeZ) |
| void | AppCycle (TInt aFrame) |
| void | FlatShading (void) |
| void | SmoothShading (void) |
| void | SetScreenSize (TUint aWidth, TUint aHeight) |
Static Public Member Functions |
|
| static CSimpleCubePbuffer * | NewL (TUint aWidth, TUint aHeight) |
Protected Member Functions |
|
| CSimpleCubePbuffer (TUint aWidth, TUint aHeight) | |
| void | ConstructL (void) |
Private Attributes |
|
| TUint | iScreenWidth |
| TUint | iScreenHeight |
|
|
Destructor. Does nothing. Definition at line 124 of file SimpleCubePbuffer.cpp.
|
|
||||||||||||
|
Standard constructor that must never Leave. Stores the given screen width and height.
Definition at line 117 of file SimpleCubePbuffer.cpp. Referenced by NewL(). 00117 : 00118 iScreenWidth( aWidth ), 00119 iScreenHeight( aHeight ) 00120 { 00121 }
|
|
||||||||||||
|
Factory method for creating a new CSimpleCubePbuffer object. Definition at line 97 of file SimpleCubePbuffer.cpp. References CSimpleCubePbuffer(). Referenced by CSimpleCubePbufferContainer::ConstructL(). 00098 { 00099 /* Symbian 2-phase constructor. Calls both the default 00100 C++ constructor and Symbian ConstructL methods */ 00101 CSimpleCubePbuffer* self = new (ELeave) CSimpleCubePbuffer( aWidth, aHeight ); 00102 CleanupStack::PushL( self ); 00103 self->ConstructL(); 00104 CleanupStack::Pop(); 00105 00106 return self; 00107 }
|
|
|
Initializes OpenGL ES, sets the vertex and color arrays and pointers. Also selects the shading mode. Definition at line 148 of file SimpleCubePbuffer.cpp. References iScreenHeight, iScreenWidth, and SetScreenSize(). Referenced by CSimpleCubePbufferContainer::ConstructL(). 00149 { 00150 // Initialize viewport, projection and OpenGL state. 00151 SetScreenSize( iScreenWidth, iScreenHeight ); 00152 }
|
|
|
Called upon application exit. Does nothing. Definition at line 161 of file SimpleCubePbuffer.cpp. Referenced by CSimpleCubePbufferContainer::~CSimpleCubePbufferContainer().
|
|
||||||||||||||||
|
Draws a 3D box.Scales the box to the given size using glScalef.
Definition at line 174 of file SimpleCubePbuffer.cpp. Referenced by AppCycle(). 00175 { 00176 glScalef( aSizeX, aSizeY, aSizeZ ); 00177 00178 glDrawElements( GL_TRIANGLES, 12 * 3, GL_UNSIGNED_BYTE, triangles ); 00179 }
|
|
|
Renders one frame.
Definition at line 190 of file SimpleCubePbuffer.cpp. References DrawBox(). Referenced by CSimpleCubePbufferContainer::DrawCallBack(). 00191 { 00192 00193 glClear( GL_COLOR_BUFFER_BIT ); 00194 00195 // Animate and draw box 00196 glLoadIdentity(); 00197 glTranslatex( 0 , 0 , -cameraDistance << 16 ); 00198 glRotatex( aFrame << 16, 1 << 16, 0 , 0 ); 00199 glRotatex( aFrame << 15, 0 , 1 << 16, 0 ); 00200 glRotatex( aFrame << 14, 0 , 0 , 1 << 16 ); 00201 DrawBox( 15.f, 15.f, 15.f ); 00202 }
|
|
|
Sets the shading mode to flat. Definition at line 217 of file SimpleCubePbuffer.cpp. Referenced by CSimpleCubePbufferAppUi::HandleCommandL().
|
|
|
Sets the shading to smooth (gradient). Definition at line 230 of file SimpleCubePbuffer.cpp. Referenced by CSimpleCubePbufferAppUi::HandleCommandL().
|
|
||||||||||||
|
Notifies that the screen size has dynamically changed during execution of this program. Resets the viewport to this new size.
Definition at line 241 of file SimpleCubePbuffer.cpp. References iScreenHeight, and iScreenWidth. Referenced by AppInit(), and CSimpleCubePbufferContainer::SizeChanged(). 00242 { 00243 iScreenWidth = aWidth; 00244 iScreenHeight = aHeight; 00245 00246 // Reinitialize OpenGL ES 00247 // Set the screen background color. 00248 glClearColor( 0.f, 0.f, 0.f, 1.f ); 00249 00250 // Enable back face culling. 00251 glEnable( GL_CULL_FACE ); 00252 00253 // Initialize viewport and projection. 00254 glViewport( 0, 0, iScreenWidth, iScreenHeight ); 00255 glMatrixMode( GL_PROJECTION ); 00256 glFrustumf( -1.f, 1.f, -1.f, 1.f, 3.f, 1000.f ); 00257 glMatrixMode( GL_MODELVIEW ); 00258 00259 // Enable vertex arrays. 00260 glEnableClientState( GL_VERTEX_ARRAY ); 00261 00262 // Set array pointers. 00263 glVertexPointer( 3, GL_BYTE, 0, vertices ); 00264 00265 // Enable color arrays. 00266 glEnableClientState( GL_COLOR_ARRAY ); 00267 00268 // Set color pointers. 00269 glColorPointer( 4, GL_UNSIGNED_BYTE, 0, colors ); 00270 00271 // Set the initial shading mode 00272 glShadeModel( GL_FLAT ); 00273 00274 // Do not use perspective correction 00275 glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST ); 00276 00277 // Recalculate the view frustrum 00278 glMatrixMode( GL_PROJECTION ); 00279 glLoadIdentity(); 00280 GLfloat aspectRatio = (GLfloat)(iScreenWidth) / (GLfloat)(iScreenHeight); 00281 glFrustumf( FRUSTUM_LEFT * aspectRatio, FRUSTUM_RIGHT * aspectRatio, 00282 FRUSTUM_BOTTOM, FRUSTUM_TOP, 00283 FRUSTUM_NEAR, FRUSTUM_FAR ); 00284 glMatrixMode( GL_MODELVIEW ); 00285 }
|
|
|
Second phase contructor. Does nothing. Definition at line 136 of file SimpleCubePbuffer.cpp.
|
|
© Nokia 2009 |