|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : SimpleCubePixmap.h 00004 * Part of : OpenGLEx / SimpleCubePixmap 00005 * 00006 * Copyright (c) 2004-2006 Nokia Corporation. 00007 * This material, including documentation and any related 00008 * computer programs, is protected by copyright controlled by 00009 * Nokia Corporation. 00010 * ============================================================================== 00011 */ 00012 00013 #ifndef SIMPLECUBEPIXMAP_H 00014 #define SIMPLECUBEPIXMAP_H 00015 00016 // INCLUDES 00017 #include <e32base.h> // for CBase definition 00018 #include <GLES/gl.h> // OpenGL ES header file 00019 00020 // MACROS 00021 #define FRUSTUM_LEFT -1.f //left vertical clipping plane 00022 #define FRUSTUM_RIGHT 1.f //right vertical clipping plane 00023 #define FRUSTUM_BOTTOM -1.f //bottom horizontal clipping plane 00024 #define FRUSTUM_TOP 1.f //top horizontal clipping plane 00025 #define FRUSTUM_NEAR 3.f //near depth clipping plane 00026 #define FRUSTUM_FAR 1000.f //far depth clipping plane 00027 00028 // CLASS DECLARATION 00029 00030 /** 00031 * Class that does the actual OpenGL ES rendering. 00032 */ 00033 class CSimpleCubePixmap : public CBase 00034 { 00035 public: // Constructors and destructor 00036 00037 /** 00038 * Factory method for creating a new CSimpleCubePixmap object. 00039 */ 00040 static CSimpleCubePixmap* NewL( TUint aWidth, TUint aHeight); 00041 00042 /** 00043 * Destructor. Does nothing. 00044 */ 00045 virtual ~CSimpleCubePixmap(); 00046 00047 public: // New functions 00048 00049 /** 00050 * Initializes OpenGL ES, sets the vertex and color 00051 * arrays and pointers. Also selects the shading mode. 00052 */ 00053 void AppInit( void ); 00054 00055 /** 00056 * Called upon application exit. Does nothing. 00057 */ 00058 void AppExit( void ); 00059 00060 /** 00061 * Draws a 3D box. Scales the box to the given size using glScalef. 00062 * @param aSizeX X-size of the box. 00063 * @param aSizeY Y-size of the box. 00064 * @param aSizeZ Z-size of the box. 00065 */ 00066 void DrawBox( GLfloat aSizeX, GLfloat aSizeY, GLfloat aSizeZ ); 00067 00068 /** 00069 * Renders one frame. 00070 * @param aFrame Number of the frame to be rendered. 00071 */ 00072 void AppCycle( TInt aFrame ); 00073 00074 /** 00075 * Sets the shading mode to flat. 00076 */ 00077 void FlatShading( void ); 00078 00079 /** 00080 * Sets the shading to smooth (gradient). 00081 */ 00082 void SmoothShading( void ); 00083 00084 /** 00085 * Notifies that the screen size has dynamically changed during execution of 00086 * this program. Resets the viewport to this new size. 00087 * @param aWidth New width of the screen. 00088 * @param aHeight New height of the screen. 00089 */ 00090 void SetScreenSize( TUint aWidth, TUint aHeight ); 00091 00092 protected: // New functions 00093 00094 /** 00095 * Standard constructor that must never Leave. 00096 * Stores the given screen width and height. 00097 * @param aWidth Width of the screen. 00098 * @param aHeight Height of the screen. 00099 */ 00100 CSimpleCubePixmap( TUint aWidth, TUint aHeight); 00101 00102 /** 00103 * Second phase contructor. Does nothing. 00104 */ 00105 void ConstructL( void ); 00106 00107 private: // Data 00108 00109 /** Width of the screen */ 00110 TUint iScreenWidth; 00111 00112 /** Height of the screen */ 00113 TUint iScreenHeight; 00114 }; 00115 00116 #endif // SIMPLECUBEPIXMAP_H 00117 00118 // End of File
|
© Nokia 2009 |