egl/sfegltest/src/gles1cube.cpp
author Gareth Stockwell <gareth.stockwell@accenture.com>
Fri, 05 Nov 2010 17:31:20 +0000
branchbug235_bringup_0
changeset 215 097e92a68d68
permissions -rw-r--r--
Added GLES 1.x spinning cube-rendering code to eglbringuptest The coordinate, color and index data are uploaded to server-side buffers by the CGLES1Cube::KhrSetup function. CGLES1Cube::KhrPaint just sets the view matrix and issues a draw command. Which demo to display can be selected by passing its name on the command line, e.g. eglbringuptest vgline eglbringuptest gles1cube If no name is provided, the application defaults to vgline.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
215
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
     1
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
     2
// All rights reserved.
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
     7
//
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
     8
// Initial Contributors:
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    10
//
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    11
// Contributors:
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    12
//
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    13
// Description:
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    14
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    15
#include "gles1cube.h"
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    16
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    17
_LIT(KGLES1CubeName, "gles1cube");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    18
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    19
CEGLRendering* CGLES1Cube::NewL(RWindow& aWindow)
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    20
    {
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    21
    CGLES1Cube* self = new (ELeave) CGLES1Cube(aWindow);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    22
    CleanupStack::PushL(self);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    23
    self->ConstructL();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    24
    CleanupStack::Pop(self);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    25
    return self;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    26
    }
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    27
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    28
const TDesC& CGLES1Cube::Name()
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    29
	{
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    30
	return KGLES1CubeName;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    31
	}
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    32
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    33
CGLES1Cube::CGLES1Cube(RWindow& aWindow)
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    34
    :   CEGLRendering(aWindow, EGL_OPENGL_ES_API)
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    35
    {
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    36
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    37
    }
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    38
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    39
CGLES1Cube::~CGLES1Cube()
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    40
	{
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    41
	RDebug::Printf("[EBT] CGLES1Cube::~CGLES1Cube");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    42
	glDeleteBuffers(1, &iCoordinateColorBuffer);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    43
	glDeleteBuffers(1, &iIndexBuffer);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    44
	}
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    45
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    46
/*
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    47
    v6----- v4
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    48
   /|      /|
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    49
  v0------v2|
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    50
  | |     | |
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    51
  | |v7---|-|v5
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    52
  |/      |/
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    53
  v1------v3
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    54
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    55
v0: -1.0, +1.0, +1.0,
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    56
v1: -1.0, -1.0, +1.0,
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    57
v2: +1.0, +1.0, +1.0,
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    58
v3: +1.0, -1.0, +1.0,
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    59
v4: +1.0, +1.0, -1.0,
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    60
v5: +1.0, -1.0, -1.0,
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    61
v6: -1.0, +1.0, -1.0,
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    62
v7: -1.0, -1.0, -1.0,
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    63
*/
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    64
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    65
static GLfloat CoordinateData[] =
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    66
	{
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    67
	-1.0, +1.0, +1.0,	// v0
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    68
	-1.0, -1.0, +1.0,	// v1
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    69
	+1.0, +1.0, +1.0,	// v2
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    70
	+1.0, -1.0, +1.0,	// v3
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    71
	+1.0, +1.0, -1.0,	// v4
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    72
	+1.0, -1.0, -1.0,	// v5
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    73
	-1.0, +1.0, -1.0,	// v6
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    74
	-1.0, -1.0, -1.0	// v7
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    75
	};
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    76
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    77
static const TInt CoordinateElementCount = 3; // XYZ
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    78
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    79
static GLfloat ColorData[] =
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    80
	{
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    81
	 0.0,  1.0,  1.0,  1.0,	// v0
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    82
	 0.0,  0.0,  1.0,  1.0,	// v1
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    83
	 1.0,  1.0,  1.0,  1.0,	// v2
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    84
	 1.0,  0.0,  1.0,  1.0,	// v3
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    85
	 1.0,  1.0,  0.0,  1.0,	// v4
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    86
	 1.0,  0.0,  0.0,  1.0,	// v5
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    87
	 0.0,  1.0,  0.0,  1.0,	// v6
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    88
	 0.0,  0.0,  0.0,  1.0	// v7
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    89
	};
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    90
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    91
static const TInt ColorElementCount = 4; // RGBA
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    92
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    93
static GLubyte FaceData[] =
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    94
	{
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    95
	0, 1, 3, 2, // front
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    96
	2, 3, 5, 4, // right
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    97
	4, 5, 7, 6, // left
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    98
	6, 7, 1, 0, // back
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
    99
	6, 0, 2, 4, // top
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   100
	1, 7, 5, 3
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   101
	};
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   102
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   103
static const TInt VerticesPerFace = 4;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   104
static const TInt VertexCount = sizeof(FaceData) / sizeof(GLubyte);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   105
static const TInt FaceCount = VertexCount / VerticesPerFace;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   106
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   107
static const TInt TrianglesPerFace = 2;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   108
static const TInt VerticesPerTriangle = 3;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   109
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   110
static const TInt IndexCount = FaceCount * TrianglesPerFace * VerticesPerTriangle;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   111
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   112
static GLubyte FaceIndexData[] =
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   113
	{
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   114
	0, 2, 1,
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   115
	0, 3, 2
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   116
	};
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   117
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   118
void CGLES1Cube::KhrSetup()
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   119
    {
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   120
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   121
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   122
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup vertexCount %d", VertexCount);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   123
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup faceCount %d", FaceCount);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   124
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup indexCount %d", IndexCount);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   125
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   126
	const GLsizeiptr coordinateSize = CoordinateElementCount * sizeof(GLfloat);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   127
	const GLsizeiptr coordinateDataSize = VertexCount * coordinateSize;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   128
	const GLsizeiptr colorSize = ColorElementCount * sizeof(GLfloat);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   129
	const GLsizeiptr colorDataSize = VertexCount * colorSize;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   130
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   131
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup glViewport %d x %d", WindowSize().iWidth, WindowSize().iHeight);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   132
	glViewport(0, 0, WindowSize().iWidth, WindowSize().iHeight);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   133
	GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   134
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   135
	glEnable(GL_DEPTH_TEST);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   136
	glEnable(GL_CULL_FACE);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   137
	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   138
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   139
	// Create coordinate/color buffer
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   140
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup glGenBuffers vertex/color");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   141
	glGenBuffers(1, &iCoordinateColorBuffer);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   142
	GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   143
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup glBindBuffer vertex/color");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   144
	glBindBuffer(GL_ARRAY_BUFFER, iCoordinateColorBuffer);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   145
	GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   146
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   147
	// Allocate memory for coordinate/color buffer
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   148
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup glBufferData coordinate/color");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   149
	glBufferData(GL_ARRAY_BUFFER, coordinateDataSize + colorDataSize, 0, GL_STATIC_DRAW);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   150
	GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   151
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   152
	// Upload coordinate/color data
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   153
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup supply coordinate/color data");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   154
	GLubyte indexData[IndexCount];
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   155
	for (TInt i=0; i<FaceCount; ++i)
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   156
		{
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   157
		RDebug::Printf("[EBT] CGLES1Cube::KhrSetup face %d", i);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   158
		// Upload coordinate/color data for this face
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   159
		for (TInt j=0; j<VerticesPerFace; ++j)
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   160
			{
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   161
			const TInt vertexIndex = FaceData[i * VerticesPerFace + j];
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   162
			const TInt destIndex = (i * VerticesPerFace) + j;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   163
			const GLfloat *coordSrc = CoordinateData + vertexIndex * CoordinateElementCount;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   164
			const TInt coordDest = destIndex * coordinateSize;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   165
			const GLfloat *colorSrc = ColorData + vertexIndex * ColorElementCount;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   166
			const TInt colorDest = coordinateDataSize + destIndex * colorSize;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   167
			RDebug::Printf("[EBT] CGLES1Cube::KhrSetup vertex %d (%d) destIndex %d coordDest %d colorDest %d",
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   168
					       j, vertexIndex, destIndex, coordDest, colorDest);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   169
			RDebug::Printf("[EBT] CGLES1Cube::KhrSetup coord %3.1f %3.1f %3.1f",
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   170
						   *(coordSrc), *(coordSrc + 1), *(coordSrc + 2));
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   171
			RDebug::Printf("[EBT] CGLES1Cube::KhrSetup color %3.1f %3.1f %3.1f",
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   172
						   *(colorSrc), *(colorSrc + 1), *(colorSrc + 2));
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   173
			glBufferSubData(GL_ARRAY_BUFFER, coordDest, coordinateSize, coordSrc);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   174
			GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   175
			glBufferSubData(GL_ARRAY_BUFFER, colorDest, colorSize, colorSrc);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   176
			GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   177
			}
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   178
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   179
		// Store vertex indices for this face
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   180
		TInt indexDataOffset = i * TrianglesPerFace * VerticesPerTriangle;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   181
		TInt indexBase = i * VerticesPerFace;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   182
		for (TInt j=0; j<TrianglesPerFace * VerticesPerTriangle; ++j)
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   183
			{
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   184
			RDebug::Printf("[EBT] CGLES1Cube::KhrSetup index %d offset %d value %d",
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   185
						   j, indexDataOffset, indexBase + FaceIndexData[j]);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   186
			indexData[indexDataOffset++] = indexBase + FaceIndexData[j];
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   187
			}
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   188
		}
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   189
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   190
	// Tell GL engine how to unpack coordinate/color buffer
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   191
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup glVertexPointer");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   192
	glVertexPointer(CoordinateElementCount, GL_FLOAT, 0, 0);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   193
	GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   194
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup glColorPointer");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   195
	glColorPointer(ColorElementCount, GL_FLOAT, 0, reinterpret_cast<GLvoid*>(coordinateDataSize));
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   196
	GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   197
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   198
	// Create index buffer
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   199
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup glGenBuffers index");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   200
	glGenBuffers(1, &iIndexBuffer);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   201
	GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   202
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup glBindBuffer index");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   203
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, iIndexBuffer);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   204
	GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   205
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   206
	// Allocate memory for index buffer and upload index data
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   207
	RDebug::Printf("[EBT] CGLES1Cube::KhrSetup glBufferData index");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   208
	glBufferData(GL_ELEMENT_ARRAY_BUFFER, IndexCount, indexData, GL_STATIC_DRAW);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   209
	GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   210
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   211
	glEnableClientState(GL_VERTEX_ARRAY);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   212
	GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   213
	glEnableClientState(GL_COLOR_ARRAY);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   214
	GLCheckError();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   215
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   216
	StartRedrawTimer();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   217
    }
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   218
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   219
void CGLES1Cube::KhrPaint()
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   220
	{
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   221
	RDebug::Printf("[EBT] CGLES1Cube::KhrPaint");
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   222
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   223
	glLoadIdentity();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   224
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   225
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   226
	glMatrixMode(GL_PROJECTION);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   227
	glLoadIdentity();
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   228
	glOrthof(-1.5f, 1.5f, -2.5f, 2.5f, -10.5f, 10.5f);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   229
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   230
	glMatrixMode(GL_MODELVIEW);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   231
	iAngle = (iAngle + 1.0f);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   232
	if (iAngle > 360.0f)
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   233
		{
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   234
		iAngle -= 360.0f;
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   235
		}
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   236
	glRotatef(iAngle, 0.0f, 1.0f, 0.5f);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   237
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   238
	glDrawElements(GL_TRIANGLES, IndexCount, GL_UNSIGNED_BYTE, 0);
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   239
    }
097e92a68d68 Added GLES 1.x spinning cube-rendering code to eglbringuptest
Gareth Stockwell <gareth.stockwell@accenture.com>
parents:
diff changeset
   240