egl/sfegltest/src/eglrendering.cpp
author Gareth Stockwell <gareth.stockwell@accenture.com>
Fri, 22 Oct 2010 22:19:05 +0100
branchbug235_bringup_0
changeset 210 da03feddbab7
parent 205 c7cc034fd51d
child 211 3804ba25b23f
permissions -rw-r--r--
Cleaned up eglbringuptest code - Refactored CEGLRendering construction to separate EGL and VG setup - Consistently check EGL and VG errors after each API call - Standardised RDebug::Printf statements to all start with [EBT] - Removed unused libraries from MMP file - Removed unused openvgengine.h - Removed various unused member variables - Removed unused CWsCanvas class
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     1
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     2
// All rights reserved.
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     7
//
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     8
// Initial Contributors:
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    10
//
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    11
// Contributors:
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    12
//
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    13
// Description:
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    14
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    15
#include "eglrendering.h"
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    16
#include <string.h>
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    17
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    18
const TInt KTimerDelay = 0;
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    19
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    20
/** Attributes to be passed into eglChooseConfig */
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    21
const EGLint KAttribList[] =
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    22
		{
205
c7cc034fd51d Set AttribsList back to RGBA8888
bdonegan
parents: 204
diff changeset
    23
		EGL_RED_SIZE,			8,
c7cc034fd51d Set AttribsList back to RGBA8888
bdonegan
parents: 204
diff changeset
    24
		EGL_GREEN_SIZE,			8,
c7cc034fd51d Set AttribsList back to RGBA8888
bdonegan
parents: 204
diff changeset
    25
		EGL_BLUE_SIZE,			8,
c7cc034fd51d Set AttribsList back to RGBA8888
bdonegan
parents: 204
diff changeset
    26
        EGL_ALPHA_SIZE,         8,
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    27
		EGL_SURFACE_TYPE,		EGL_WINDOW_BIT,
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    28
		EGL_RENDERABLE_TYPE,	EGL_OPENVG_BIT,
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    29
		EGL_NONE
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    30
		};
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    31
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    32
void CEGLRendering::EGLCheckError()
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    33
    {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    34
    EGLint error = eglGetError();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    35
    if(EGL_SUCCESS != error)
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    36
        {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    37
        RDebug::Printf("[EBT] CEglRendering::EGLCheckError error %d", error);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    38
        User::Panic(_L("EBT-EGL"), error);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    39
        }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    40
    }
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    41
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    42
void CEGLRendering::EGLCheckReturnError(EGLBoolean aBool)
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    43
    {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    44
    if(!aBool)
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    45
        {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    46
        RDebug::Printf("[EBT] CEglRendering::EGLCheckReturnError false");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    47
        User::Panic(_L("EGL-EGL-RTN"), eglGetError());
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    48
        }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    49
    }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    50
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    51
void CEGLRendering::VGCheckError()
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    52
    {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    53
    VGint error = vgGetError();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    54
    if(VG_NO_ERROR != error)
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    55
        {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    56
        RDebug::Printf("[EBT] CEglRendering::VGCheckError error %d", error);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    57
        User::Panic(_L("EBT-VG"), error);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    58
        }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    59
    }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    60
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    61
CEGLRendering* CEGLRendering::NewL(RWindow& aWindow)
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    62
	{
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    63
	CEGLRendering* self = new (ELeave) CEGLRendering(aWindow);
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    64
	CleanupStack::PushL(self);
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    65
	self->ConstructL();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    66
    CleanupStack::Pop(self);
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    67
	return self;
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    68
	}
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    69
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    70
CEGLRendering::CEGLRendering(RWindow& aWindow)
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    71
	:  iWindow(aWindow)
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    72
	,  iCount(0)
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    73
	{
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    74
	}
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    75
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    76
/*
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    77
 * Construct EGL objects, and OpenVG binding.
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    78
 *
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    79
 * Here we collaborate with EGL to associate a session, pick and configuration, assign
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    80
 * it to the window we have, and then bind the OpenVG rendering API to our newly created
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    81
 * context.
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    82
 *
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    83
 * In bring up terms, here is where the first EGL code entry points are called from.  Its
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    84
 * the natural point where an EGL bringup starts debugging from, assuming the core EGL
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    85
 * works in terms of supporting EGL sync objects (needed for boot before we get to the
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    86
 * ESHELL command prompt).
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    87
 */
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    88
void CEGLRendering::ConstructL()
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    89
    {
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    90
	RDebug::Printf("[EBT] CEGLRendering::ConstructL");
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    91
	iTimer = CPeriodic::NewL(CActive::EPriorityIdle);
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    92
	EglSetupL();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    93
	VgSetup();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    94
	VgPaint();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    95
	}
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
    96
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    97
void CEGLRendering::EglSetupL()
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    98
    {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
    99
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglGetDisplay");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   100
    iDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   101
    EGLCheckError();
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   102
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   103
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglInitialize");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   104
    EGLCheckReturnError(eglInitialize(iDisplay, NULL, NULL));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   105
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   106
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL vendor %s", eglQueryString(iDisplay, EGL_VENDOR));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   107
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL version %s", eglQueryString(iDisplay, EGL_VERSION));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   108
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL extensions %s", eglQueryString(iDisplay, EGL_EXTENSIONS));
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   109
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   110
    // Check that EGL provides the capabilities for this app.
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   111
    if(NULL == strstr(eglQueryString(iDisplay, EGL_CLIENT_APIS), "OpenVG"))
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   112
        {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   113
        RDebug::Printf("[EBT] CEGLRendering::EglSetupL OpenVG not listed in supported client APIs %s", eglQueryString(iDisplay, EGL_CLIENT_APIS));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   114
        User::Leave(KErrNotSupported);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   115
        }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   116
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   117
    if(NULL == strstr(eglQueryString(iDisplay, EGL_EXTENSIONS), "EGL_SYMBIAN_COMPOSITION") )
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   118
        {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   119
        RDebug::Printf("[EBT] CEGLRendering::EglSetupL EGL_SYMBIAN_COMPOSITION not listed in extension string %s", eglQueryString(iDisplay, EGL_EXTENSIONS));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   120
        User::Leave(KErrNotSupported);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   121
        }
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   122
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   123
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglChooseConfig");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   124
    EGLint numConfigs = 0;
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   125
    EGLConfig chosenConfig = 0;
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   126
    EGLCheckReturnError(eglChooseConfig(iDisplay, KAttribList, &chosenConfig, 1, &numConfigs));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   127
    if (0 == numConfigs)
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   128
        {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   129
        RDebug::Printf("[EBT] No matching configs found", eglQueryString(iDisplay, EGL_EXTENSIONS));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   130
        User::Leave(KErrNotSupported);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   131
        }
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   132
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   133
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglBindApi");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   134
    EGLCheckReturnError(eglBindAPI(EGL_OPENVG_API));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   135
    
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   136
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglCreateWindowSurface");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   137
    iSurface = eglCreateWindowSurface(iDisplay, chosenConfig, &iWindow, NULL);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   138
    EGLCheckError();
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   139
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   140
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglGetConfigAttrib");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   141
    TInt redSize, greenSize, blueSize, alphaSize;
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   142
    EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_ALPHA_SIZE, &alphaSize));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   143
    EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_RED_SIZE, &redSize));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   144
    EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_GREEN_SIZE, &greenSize));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   145
    EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_BLUE_SIZE, &blueSize));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   146
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL id:%d alpha:%d red:%d green:%d blue:%d",
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   147
                   chosenConfig, alphaSize, redSize, greenSize, blueSize);
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   148
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   149
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglCreateContext");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   150
    iContext = eglCreateContext(iDisplay, chosenConfig, EGL_NO_CONTEXT, NULL);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   151
    EGLCheckError();
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   152
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   153
    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglMakeCurrent");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   154
    CEGLRendering::EGLCheckReturnError(eglMakeCurrent(iDisplay, iSurface, iSurface, iContext));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   155
    }
203
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   156
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   157
void CEGLRendering::VgSetup()
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   158
    {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   159
    static VGubyte const Segments[] =
203
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   160
        {
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   161
        VG_MOVE_TO_ABS,
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   162
        VG_LINE_TO_REL,
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   163
        VG_CLOSE_PATH
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   164
        };
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   165
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   166
    static VGfloat const Coords[] =
203
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   167
        {
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   168
        110, 35,
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   169
        50, 160,
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   170
        };
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   171
203
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   172
    VGfloat strokeColor[4]  = {1.f, 0.f, 0.f, 1.f};
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   173
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   174
    RDebug::Printf("[EBT] CEGLRendering::VgSetup vgCreatePaint");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   175
    iVGPaint = vgCreatePaint();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   176
    VGCheckError();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   177
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   178
    RDebug::Printf("[EBT] CEGLRendering::VgSetup vgSetParameterX");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   179
    vgSetParameteri(iVGPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   180
    VGCheckError();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   181
    vgSetParameterfv(iVGPaint, VG_PAINT_COLOR, 4, strokeColor);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   182
    VGCheckError();
203
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   183
    
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   184
    RDebug::Printf("[EBT] CEGLRendering::VgSetup vgCreatePath");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   185
    iVGPath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
203
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   186
                            VG_PATH_DATATYPE_F,
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   187
                            1.0f, // scale
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   188
                            0.0f, // bias
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   189
                            3,    // segmentCapacityHint
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   190
                            4,    // coordCapacityHint
203
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   191
                            VG_PATH_CAPABILITY_ALL);
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   192
    VGCheckError();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   193
    
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   194
    RDebug::Printf("[EBT] CEGLRendering::VgSetup vgAppendPathData");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   195
    vgAppendPathData(iVGPath, sizeof(Segments), Segments, Coords);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   196
    VGCheckError();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   197
    }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   198
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   199
void CEGLRendering::VgPaint()
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   200
    {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   201
    RDebug::Printf("[EBT] CEGLRendering::VgPaint vgSetPaint");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   202
    vgSetPaint(iVGPaint, VG_STROKE_PATH);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   203
    VGCheckError();
203
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   204
    
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   205
    RDebug::Printf("[EBT] CEGLRendering::VgPaint vgDrawPath");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   206
    vgDrawPath(iVGPath, VG_STROKE_PATH);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   207
    VGCheckError();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   208
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   209
    RDebug::Printf("[EBT] CEGLRendering::VgPaint eglSwapBuffers");
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   210
    eglSwapBuffers(iDisplay, iSurface);
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   211
    EGLCheckError();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   212
    }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   213
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   214
CEGLRendering::~CEGLRendering()
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   215
    {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   216
    RDebug::Printf("[EBT] CEGLRendering::~CEGLRendering");
203
71a455a885b7 Code to draw a line
bdonegan
parents: 202
diff changeset
   217
    
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   218
    Stop();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   219
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   220
    delete iTimer;
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   221
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   222
    if (EGL_NO_CONTEXT != iContext)
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   223
        {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   224
        EGLCheckReturnError(eglDestroyContext(iDisplay, iContext));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   225
        }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   226
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   227
    if (EGL_NO_SURFACE != iSurface)
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   228
        {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   229
        EGLCheckReturnError(eglDestroySurface(iDisplay,iSurface));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   230
        }
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   231
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   232
    // Call eglMakeCurrent() to ensure the surfaces and contexts are truly destroyed.
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   233
    EGLCheckReturnError(eglMakeCurrent(iDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   234
    EGLCheckReturnError(eglTerminate(iDisplay));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   235
    EGLCheckReturnError(eglReleaseThread());
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   236
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   237
    delete iBitmap;
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   238
    }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   239
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   240
void CEGLRendering::Start()
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   241
    {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   242
    // Start drawing the screen periodically
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   243
    iTimer->Start(0, KTimerDelay, TCallBack(TimerCallBack, this));
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   244
    }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   245
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   246
void CEGLRendering::Stop()
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   247
    {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   248
    if(iTimer)
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   249
        {
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   250
        iTimer->Cancel();
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   251
        }
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   252
    }
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   253
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   254
/** Update the display */
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   255
void CEGLRendering::UpdateDisplay()
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   256
	{
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   257
	// Flush colour buffer to the window surface
204
3f7664f3b0f4 Stop flickering and set painter
bdonegan
parents: 203
diff changeset
   258
	//CEGLRendering::EGLCheckReturnError(eglSwapBuffers(iDisplay, iSurface));
193
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   259
	}
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   260
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   261
/** Callback called by refresh timer */
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   262
TInt CEGLRendering::TimerCallBack(TAny* aDemo)
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   263
	{
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   264
	static_cast<CEGLRendering*>(aDemo)->UpdateDisplay();
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   265
	return KErrNone;
bbf967b65d9e Add a bringup test program. Rom build is: buildrom syborg minigui_simulator eglbringuptest.iby The command to run is called ebt. See mmp file for documentation.
Faisal Memon <faisal.memon@nokia.com>
parents:
diff changeset
   266
	}
210
da03feddbab7 Cleaned up eglbringuptest code
Gareth Stockwell <gareth.stockwell@accenture.com>
parents: 205
diff changeset
   267