os/graphics/graphicsdeviceinterface/directgdi/test/tdirectgdieglcontent_cube.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @test
sl@0
    19
 @internalComponent - Internal Symbian test code 
sl@0
    20
*/
sl@0
    21
sl@0
    22
#ifndef __TDIRECTGDIEGLCONTENT_CUBE_H__
sl@0
    23
#define __TDIRECTGDIEGLCONTENT_CUBE_H__
sl@0
    24
sl@0
    25
#include <e32base.h>
sl@0
    26
#include <pixelformats.h>
sl@0
    27
#include <graphics/sgimage.h>
sl@0
    28
#include <graphics/sgimagecollection.h>
sl@0
    29
#include <GLES/egl.h>
sl@0
    30
sl@0
    31
const TInt KEglContentBuffers = 2;
sl@0
    32
sl@0
    33
/**
sl@0
    34
This class contains cube GL renderer.
sl@0
    35
CGLCube initializes the EGL environment and renders off-screen pixmap surfaces. 
sl@0
    36
Creation of the pixmap is based on RSgImage resource which is initialized 
sl@0
    37
with parameter  TsgImageInfo.iUsage set to EsgUsageOpenGlesTarget|ESgUsageDirectGdiSource.  
sl@0
    38
OpenGL ES API is used to reneder content of the pixmap. The result is available as a TSgDrawableId object.
sl@0
    39
*/
sl@0
    40
class CGLCube : public CBase
sl@0
    41
	{
sl@0
    42
public:
sl@0
    43
	static CGLCube* NewL(TUidPixelFormat aPixelFormat, const TSize& aSize);
sl@0
    44
	static CGLCube* NewLC(TUidPixelFormat aPixelFormat, const TSize& aSize);
sl@0
    45
	virtual ~CGLCube();
sl@0
    46
sl@0
    47
	void Render(TInt aFrame);
sl@0
    48
	void GetImage(TSgDrawableId& aId);
sl@0
    49
sl@0
    50
private:
sl@0
    51
	CGLCube();
sl@0
    52
	void ConstructL(TUidPixelFormat aPixelFormat, const TSize& aSize);
sl@0
    53
	void InitEglL(TUidPixelFormat aPixelFormat, const TSize& aSize);
sl@0
    54
	void DeInitEgl();
sl@0
    55
sl@0
    56
private:
sl@0
    57
	/** Display where the OpenGL ES window surface resides. */
sl@0
    58
	EGLDisplay iEglDisplay;
sl@0
    59
sl@0
    60
	/** Describes the format, type and size of the color buffers and ancillary buffers for EGLSurface. */
sl@0
    61
	EGLConfig iConfig;
sl@0
    62
sl@0
    63
	/** The image where the framebuffer is drawn. */
sl@0
    64
	TSgImageInfo iImageInfo;
sl@0
    65
	RSgImage iImages[KEglContentBuffers];
sl@0
    66
sl@0
    67
	/** Current image buffer number */
sl@0
    68
	TInt iCurrentImage;
sl@0
    69
	TInt iLastImage;
sl@0
    70
sl@0
    71
	/** Pixmap surface (that uses the iPixmap) that is the target of OpenGL ES graphics rendering. */
sl@0
    72
	EGLSurface iEglSurfaces[KEglContentBuffers];
sl@0
    73
sl@0
    74
	/** OpenGL ES rendering context. */
sl@0
    75
	EGLContext iEglContext;
sl@0
    76
sl@0
    77
	/** OpenGL ES Texture id */
sl@0
    78
	GLuint iTexId;
sl@0
    79
	};
sl@0
    80
sl@0
    81
#endif