Update contrib.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
22 #ifndef __TDIRECTGDIEGLCONTENT_CUBE_H__
23 #define __TDIRECTGDIEGLCONTENT_CUBE_H__
26 #include <pixelformats.h>
27 #include <graphics/sgimage.h>
28 #include <graphics/sgimagecollection.h>
31 const TInt KEglContentBuffers = 2;
34 This class contains cube GL renderer.
35 CGLCube initializes the EGL environment and renders off-screen pixmap surfaces.
36 Creation of the pixmap is based on RSgImage resource which is initialized
37 with parameter TsgImageInfo.iUsage set to EsgUsageOpenGlesTarget|ESgUsageDirectGdiSource.
38 OpenGL ES API is used to reneder content of the pixmap. The result is available as a TSgDrawableId object.
40 class CGLCube : public CBase
43 static CGLCube* NewL(TUidPixelFormat aPixelFormat, const TSize& aSize);
44 static CGLCube* NewLC(TUidPixelFormat aPixelFormat, const TSize& aSize);
47 void Render(TInt aFrame);
48 void GetImage(TSgDrawableId& aId);
52 void ConstructL(TUidPixelFormat aPixelFormat, const TSize& aSize);
53 void InitEglL(TUidPixelFormat aPixelFormat, const TSize& aSize);
57 /** Display where the OpenGL ES window surface resides. */
58 EGLDisplay iEglDisplay;
60 /** Describes the format, type and size of the color buffers and ancillary buffers for EGLSurface. */
63 /** The image where the framebuffer is drawn. */
64 TSgImageInfo iImageInfo;
65 RSgImage iImages[KEglContentBuffers];
67 /** Current image buffer number */
71 /** Pixmap surface (that uses the iPixmap) that is the target of OpenGL ES graphics rendering. */
72 EGLSurface iEglSurfaces[KEglContentBuffers];
74 /** OpenGL ES rendering context. */
75 EGLContext iEglContext;
77 /** OpenGL ES Texture id */