cameralityglrenderer.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright (c) 2010-2011 Nokia Corporation and/or its subsidiary(-ies).
  3. * All rights reserved.
  4. * This component and the accompanying materials are made available
  5. * under the terms of "Eclipse Public License v1.0"
  6. * which accompanies this distribution, and is available
  7. * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  8. *
  9. * Initial Contributors:
  10. * Nokia Corporation - initial contribution.
  11. *
  12. * Contributors:
  13. *
  14. * Description: Camerality OpenGL Renderer for a window.
  15. *
  16. */
  17. #ifndef CAMERALITYGLRENDERER_H_
  18. #define CAMERALITYGLRENDERER_H_
  19. // INCLUDES
  20. #include <EGL/egl.h>
  21. #include <GLES/gl.h>
  22. // FORWARD DECLARATIONS
  23. class CPeriodic;
  24. class CAlfCompositionSource;
  25. // CLASS DECLARATION
  26. class CCameralityGLRenderer : public CBase
  27. {
  28. public:
  29. static CCameralityGLRenderer* NewL();
  30. virtual ~CCameralityGLRenderer();
  31. public: // New methods
  32. void Start(RWindow& aWindow);
  33. void Resize(const TSize& aSize);
  34. void Stop();
  35. EGLDisplay Display() const;
  36. private: // Private methods
  37. static TInt RenderCallback(TAny* aInstance);
  38. void SetupScene();
  39. TInt RenderScene();
  40. void DrawBox(GLfixed aSizeX, GLfixed aSizeY, GLfixed aSizeZ);
  41. private: // Private constructors
  42. CCameralityGLRenderer();
  43. void ConstructL();
  44. private: // Data
  45. enum TState {
  46. EIdle,
  47. ERendering
  48. };
  49. /** State of the renderer. */
  50. TState iState;
  51. /** Display where the OpenGL ES window surface resides. */
  52. EGLDisplay iEglDisplay;
  53. /** Window surface where the OpenGL ES rendering is blitted to. */
  54. EGLSurface iEglSurface;
  55. /** OpenGL ES rendering context. */
  56. EGLContext iEglContext;
  57. EGLConfig iConfig;
  58. /** Active object that is the timing source for the animation. */
  59. CPeriodic* iPeriodic;
  60. CAlfCompositionSource* iCompSource;
  61. RWindow* iWindow;
  62. TUint iScreenWidth;
  63. TUint iScreenHeight;
  64. TInt iFrame;
  65. };
  66. #endif /* CAMERALITYGLRENDERER_H_ */