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