1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsdeviceinterface/directgdi/test/tdirectgdieglcontent_cube.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,81 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 + @internalComponent - Internal Symbian test code
1.23 +*/
1.24 +
1.25 +#ifndef __TDIRECTGDIEGLCONTENT_CUBE_H__
1.26 +#define __TDIRECTGDIEGLCONTENT_CUBE_H__
1.27 +
1.28 +#include <e32base.h>
1.29 +#include <pixelformats.h>
1.30 +#include <graphics/sgimage.h>
1.31 +#include <graphics/sgimagecollection.h>
1.32 +#include <GLES/egl.h>
1.33 +
1.34 +const TInt KEglContentBuffers = 2;
1.35 +
1.36 +/**
1.37 +This class contains cube GL renderer.
1.38 +CGLCube initializes the EGL environment and renders off-screen pixmap surfaces.
1.39 +Creation of the pixmap is based on RSgImage resource which is initialized
1.40 +with parameter TsgImageInfo.iUsage set to EsgUsageOpenGlesTarget|ESgUsageDirectGdiSource.
1.41 +OpenGL ES API is used to reneder content of the pixmap. The result is available as a TSgDrawableId object.
1.42 +*/
1.43 +class CGLCube : public CBase
1.44 + {
1.45 +public:
1.46 + static CGLCube* NewL(TUidPixelFormat aPixelFormat, const TSize& aSize);
1.47 + static CGLCube* NewLC(TUidPixelFormat aPixelFormat, const TSize& aSize);
1.48 + virtual ~CGLCube();
1.49 +
1.50 + void Render(TInt aFrame);
1.51 + void GetImage(TSgDrawableId& aId);
1.52 +
1.53 +private:
1.54 + CGLCube();
1.55 + void ConstructL(TUidPixelFormat aPixelFormat, const TSize& aSize);
1.56 + void InitEglL(TUidPixelFormat aPixelFormat, const TSize& aSize);
1.57 + void DeInitEgl();
1.58 +
1.59 +private:
1.60 + /** Display where the OpenGL ES window surface resides. */
1.61 + EGLDisplay iEglDisplay;
1.62 +
1.63 + /** Describes the format, type and size of the color buffers and ancillary buffers for EGLSurface. */
1.64 + EGLConfig iConfig;
1.65 +
1.66 + /** The image where the framebuffer is drawn. */
1.67 + TSgImageInfo iImageInfo;
1.68 + RSgImage iImages[KEglContentBuffers];
1.69 +
1.70 + /** Current image buffer number */
1.71 + TInt iCurrentImage;
1.72 + TInt iLastImage;
1.73 +
1.74 + /** Pixmap surface (that uses the iPixmap) that is the target of OpenGL ES graphics rendering. */
1.75 + EGLSurface iEglSurfaces[KEglContentBuffers];
1.76 +
1.77 + /** OpenGL ES rendering context. */
1.78 + EGLContext iEglContext;
1.79 +
1.80 + /** OpenGL ES Texture id */
1.81 + GLuint iTexId;
1.82 + };
1.83 +
1.84 +#endif