|
1 // Copyright (c) 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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 |
|
23 #include "tflowwindowopengl.h" |
|
24 |
|
25 |
|
26 CTWindow* CTFlowWindowOpenGL::NewL(RWsSession &aWs, |
|
27 const RWindowTreeNode &aParent, |
|
28 const TPoint& aStartingPoint, |
|
29 const TSize& aWindowSize) |
|
30 { |
|
31 CTFlowWindowOpenGL* self = new (ELeave)CTFlowWindowOpenGL(aStartingPoint, aWindowSize); |
|
32 CleanupStack::PushL(self); |
|
33 self->ConstructL(aWs, aParent); |
|
34 CleanupStack::Pop(self); |
|
35 return self; |
|
36 } |
|
37 |
|
38 CTFlowWindowOpenGL::CTFlowWindowOpenGL(const TPoint& aStartingPoint, const TSize& aWindowSize) : |
|
39 CTWindow(aStartingPoint, aWindowSize) |
|
40 { |
|
41 // empty |
|
42 } |
|
43 |
|
44 /** |
|
45 * Constructs EGL environment, model and output objects which are used to render |
|
46 * OpenGL ES content. |
|
47 * |
|
48 */ |
|
49 void CTFlowWindowOpenGL::ConstructL(RWsSession &aWs, const RWindowTreeNode &aParent) |
|
50 { |
|
51 CTWindow::ConstructL(aWs, aParent); |
|
52 iEglEnvironment = CEglEnvironment::NewL(iWindow); |
|
53 iModel = CModel::NewL(iEglEnvironment->Display(), iEglEnvironment->Surface()); |
|
54 } |
|
55 |
|
56 CTFlowWindowOpenGL::~CTFlowWindowOpenGL() |
|
57 { |
|
58 delete iEglEnvironment; |
|
59 delete iModel; |
|
60 } |
|
61 |
|
62 /** |
|
63 * Render one OpenGL ES scene and draw it to the screen. |
|
64 */ |
|
65 void CTFlowWindowOpenGL::RenderL() |
|
66 { |
|
67 CTWindow::RenderL(); |
|
68 iTime++; |
|
69 iModel->DrawToBuffer(iTime); |
|
70 iEglEnvironment->DrawToWindow(); |
|
71 } |
|
72 |
|
73 void CTFlowWindowOpenGL::SetResolutionL(TInt aResolution) |
|
74 { |
|
75 iModel->SetResolutionL(aResolution); |
|
76 } |