EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGLES_CM", "GLES2\libGLES_CM\libGLES_CM.vcxproj", "{235B1D85-E6B6-45E2-BA5D-5C60396428FF}"\r
EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OGLESBasicTnL", "..\tests\third_party\PowerVR\Examples\Beginner\04_BasicTnL\OGLES\Build\WindowsVC2010\OGLESBasicTnL.vcxproj", "{AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {235B1D85-E6B6-45E2-BA5D-5C60396428FF} = {235B1D85-E6B6-45E2-BA5D-5C60396428FF}\r
+ {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6} = {E746FCA9-64C3-433E-85E8-9A5A67AB7ED6}\r
+ EndProjectSection\r
+EndProject\r
Global\r
GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
Debug|Win32 = Debug|Win32\r
{235B1D85-E6B6-45E2-BA5D-5C60396428FF}.Release|Win32.ActiveCfg = Release|Win32\r
{235B1D85-E6B6-45E2-BA5D-5C60396428FF}.Release|Win32.Build.0 = Release|Win32\r
{235B1D85-E6B6-45E2-BA5D-5C60396428FF}.Release|x64.ActiveCfg = Release|Win32\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Debug|Win32.Build.0 = Debug|Win32\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Debug|x64.ActiveCfg = Debug|x64\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Debug|x64.Build.0 = Debug|x64\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Profile|Win32.ActiveCfg = Release|Win32\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Profile|Win32.Build.0 = Release|Win32\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Profile|x64.ActiveCfg = Release|x64\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Profile|x64.Build.0 = Release|x64\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Release|Win32.ActiveCfg = Release|Win32\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Release|Win32.Build.0 = Release|Win32\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Release|x64.ActiveCfg = Release|x64\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Release|x64.Build.0 = Release|x64\r
EndGlobalSection\r
GlobalSection(SolutionProperties) = preSolution\r
HideSolutionNode = FALSE\r
{9CF4408B-9B08-481F-95DA-3DF0846DABE4} = {ED25C308-5BDB-43A7-BED6-C2C059FC2D7D}\r
{09ABE661-9BC0-4152-A820-1FB0522CAC01} = {ED25C308-5BDB-43A7-BED6-C2C059FC2D7D}\r
{04FC5430-3F1B-42A2-A18A-D8BB7E5B2733} = {ED25C308-5BDB-43A7-BED6-C2C059FC2D7D}\r
+ {AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5} = {ED25C308-5BDB-43A7-BED6-C2C059FC2D7D}\r
EndGlobalSection\r
EndGlobal\r
--- /dev/null
+:Title:
+BasicTnL
+
+:ShortDescription:
+This training course consists of a demonstration of basic transformation and lighting.
+
+:FullDescription:
+This training course consists of a demonstration of basic transformation and lighting, growing on the basic drawing techniques learnt in HelloTriangle.
+
+Controls:
+ - Esc - Close the application
+
+:VGP:
+Not Required
+
+:PolyCount:
+1
+
+:VertexCount:
+3
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup Label="ProjectConfigurations">\r
+ <ProjectConfiguration Include="Debug|Win32">\r
+ <Configuration>Debug</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Debug|x64">\r
+ <Configuration>Debug</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Release|Win32">\r
+ <Configuration>Release</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Release|x64">\r
+ <Configuration>Release</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ </ItemGroup>\r
+ <PropertyGroup Label="Globals">\r
+ <ProjectGuid>{AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}</ProjectGuid>\r
+ <RootNamespace>OGLESBasicTnL</RootNamespace>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ <CharacterSet>MultiByte</CharacterSet>\r
+ <PlatformToolset>v120</PlatformToolset>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ <CharacterSet>MultiByte</CharacterSet>\r
+ <PlatformToolset>v120</PlatformToolset>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <CharacterSet>MultiByte</CharacterSet>\r
+ <PlatformToolset>v120</PlatformToolset>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <CharacterSet>MultiByte</CharacterSet>\r
+ <PlatformToolset>v120</PlatformToolset>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+ <ImportGroup Label="ExtensionSettings">\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <PropertyGroup Label="UserMacros" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <OutDir>$(SolutionDir)$(Configuration)\</OutDir>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <OutDir>$(SolutionDir)$(Configuration)\</OutDir>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>\r
+ </PropertyGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <ClCompile>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>Disabled</Optimization>\r
+ <PreprocessorDefinitions>BUILD_OGLES;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>..\..\..\..\..\..\Shell;..\..\..\..\..\..\Shell\API\KEGL;..\..\..\..\..\..\Shell\OS\Windows;..\..\..\..\..\..\Builds\Include;</AdditionalIncludeDirectories>\r
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
+ <MinimalRebuild>false</MinimalRebuild>\r
+ </ClCompile>\r
+ <Link>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>..\..\..\..\..\..\Builds\Windows\x86_32\Lib;</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>libGLES_CM.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+ <ClCompile>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>Disabled</Optimization>\r
+ <PreprocessorDefinitions>BUILD_OGLES;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>..\..\..\..\..\..\Shell;..\..\..\..\..\..\Shell\API\KEGL;..\..\..\..\..\..\Shell\OS\Windows;..\..\..\..\..\..\Builds\Include;</AdditionalIncludeDirectories>\r
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
+ <MinimalRebuild>false</MinimalRebuild>\r
+ </ClCompile>\r
+ <Link>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <AdditionalLibraryDirectories>..\..\..\..\..\..\Builds\Windows\x86_64\Lib;</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>libGLES_CM.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <ClCompile>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>MaxSpeed</Optimization>\r
+ <FunctionLevelLinking>true</FunctionLevelLinking>\r
+ <IntrinsicFunctions>true</IntrinsicFunctions>\r
+ <PreprocessorDefinitions>BUILD_OGLES;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>..\..\..\..\..\..\Shell;..\..\..\..\..\..\Shell\API\KEGL;..\..\..\..\..\..\Shell\OS\Windows;..\..\..\..\..\..\Builds\Include;</AdditionalIncludeDirectories>\r
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
+ <MinimalRebuild>false</MinimalRebuild>\r
+ </ClCompile>\r
+ <Link>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+ <OptimizeReferences>true</OptimizeReferences>\r
+ <AdditionalLibraryDirectories>..\..\..\..\..\..\Builds\Windows\x86_32\Lib;</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>libGLES_CM.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+ <ClCompile>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>MaxSpeed</Optimization>\r
+ <FunctionLevelLinking>true</FunctionLevelLinking>\r
+ <IntrinsicFunctions>true</IntrinsicFunctions>\r
+ <PreprocessorDefinitions>BUILD_OGLES;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <AdditionalIncludeDirectories>..\..\..\..\..\..\Shell;..\..\..\..\..\..\Shell\API\KEGL;..\..\..\..\..\..\Shell\OS\Windows;..\..\..\..\..\..\Builds\Include;</AdditionalIncludeDirectories>\r
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
+ <MinimalRebuild>false</MinimalRebuild>\r
+ </ClCompile>\r
+ <Link>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+ <OptimizeReferences>true</OptimizeReferences>\r
+ <AdditionalLibraryDirectories>..\..\..\..\..\..\Builds\Windows\x86_64\Lib;</AdditionalLibraryDirectories>\r
+ <AdditionalDependencies>libGLES_CM.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="..\..\OGLESBasicTnL.cpp" />\r
+ <ClCompile Include="..\..\..\..\..\..\Shell\PVRShell.cpp" />\r
+ <ClCompile Include="..\..\..\..\..\..\Shell\API\KEGL\PVRShellAPI.cpp" />\r
+ <ClCompile Include="..\..\..\..\..\..\Shell\OS\Windows\PVRShellOS.cpp" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="..\..\..\..\..\..\Shell\PVRShell.h" />\r
+ <ClInclude Include="..\..\..\..\..\..\Shell\PVRShellImpl.h" />\r
+ <ClInclude Include="..\..\..\..\..\..\Shell\API\KEGL\PVRShellAPI.h" />\r
+ <ClInclude Include="..\..\..\..\..\..\Shell\OS\Windows\PVRShellOS.h" />\r
+ <ClInclude Include="..\..\..\..\..\..\Builds\Windows\Resources\resource.h" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ResourceCompile Include="..\..\..\..\..\..\Builds\Windows\Resources\shared.rc" />\r
+ </ItemGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+ <ImportGroup Label="ExtensionTargets">\r
+ </ImportGroup>\r
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup>\r
+ <Filter Include="Source Files">\r
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
+ </Filter>\r
+ <Filter Include="Header Files">\r
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
+ </Filter>\r
+ <Filter Include="Resource Files">\r
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r
+ </Filter>\r
+ <Filter Include="Content Files">\r
+ <UniqueIdentifier>{900022e4-757a-46fb-bd53-6dfc20b3d893}</UniqueIdentifier>\r
+ </Filter>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="..\..\..\..\..\..\Shell\PVRShell.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\..\..\..\Shell\PVRShellImpl.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\..\..\..\Shell\API\KEGL\PVRShellAPI.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\..\..\..\Shell\OS\Windows\PVRShellOS.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\..\..\..\Builds\Windows\Resources\resource.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ResourceCompile Include="..\..\..\..\..\..\Builds\Windows\Resources\shared.rc">\r
+ <Filter>Resource Files</Filter>\r
+ </ResourceCompile>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="..\..\OGLESBasicTnL.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\..\..\..\Shell\PVRShell.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\..\..\..\Shell\API\KEGL\PVRShellAPI.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\..\..\..\Shell\OS\Windows\PVRShellOS.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+<ItemGroup>\r
+ </ItemGroup>\r
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <LocalDebuggerEnvironment>PATH=$(SolutionDir)..\lib\$(Configuration)</LocalDebuggerEnvironment>\r
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <LocalDebuggerEnvironment>PATH=$(SolutionDir)..\lib\$(Configuration)</LocalDebuggerEnvironment>\r
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+ <LocalDebuggerEnvironment>PATH=$(SolutionDir)..\lib\$(Configuration)</LocalDebuggerEnvironment>\r
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+ <LocalDebuggerEnvironment>PATH=$(SolutionDir)..\lib\$(Configuration)</LocalDebuggerEnvironment>\r
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\r
+ </PropertyGroup>\r
+</Project>
\ No newline at end of file
--- /dev/null
+/******************************************************************************
+
+ @File OGLESBasicTnL.cpp
+
+ @Title Shows basic transformations and lighting
+
+ @Version
+
+ @Copyright Copyright (c) Imagination Technologies Limited.
+
+ @Platform Independant
+
+ @Description Shows basic transformations and lighting
+
+******************************************************************************/
+#include "PVRShell.h"
+#include <math.h>
+
+#if defined(__APPLE__) && defined (TARGET_OS_IPHONE)
+#import <OpenGLES/ES1/gl.h>
+#import <OpenGLES/ES1/glext.h>
+#else
+#include <GLES/gl.h>
+#endif
+
+/******************************************************************************
+ Defines
+******************************************************************************/
+// Size of the texture we create
+const int g_i32TexSize = 128;
+
+/*!****************************************************************************
+ Class implementing the PVRShell functions.
+******************************************************************************/
+class OGLESBasicTnL : public PVRShell
+{
+ // Texture handle
+ GLuint m_ui32Texture;
+
+ // Angle to rotate the triangle
+ float m_fAngle;
+
+ // Vertex Buffer Object (VBO) handle
+ GLuint m_ui32Vbo;
+
+public:
+ virtual bool InitApplication();
+ virtual bool InitView();
+ virtual bool ReleaseView();
+ virtual bool QuitApplication();
+ virtual bool RenderScene();
+};
+
+
+/*!****************************************************************************
+ @Function InitApplication
+ @Return bool true if no error occured
+ @Description Code in InitApplication() will be called by PVRShell once per
+ run, before the rendering context is created.
+ Used to initialize variables that are not dependant on it
+ (e.g. external modules, loading meshes, etc.)
+ If the rendering context is lost, InitApplication() will
+ not be called again.
+******************************************************************************/
+bool OGLESBasicTnL::InitApplication()
+{
+ m_fAngle = 0;
+ return true;
+}
+
+/*!****************************************************************************
+ @Function QuitApplication
+ @Return bool true if no error occured
+ @Description Code in QuitApplication() will be called by PVRShell once per
+ run, just before exiting the program.
+ If the rendering context is lost, QuitApplication() will
+ not be called.
+******************************************************************************/
+bool OGLESBasicTnL::QuitApplication()
+{
+ return true;
+}
+
+/*!****************************************************************************
+ @Function InitView
+ @Return bool true if no error occured
+ @Description Code in InitView() will be called by PVRShell upon
+ initialization or after a change in the rendering context.
+ Used to initialize variables that are dependant on the rendering
+ context (e.g. textures, vertex buffers, etc.)
+******************************************************************************/
+bool OGLESBasicTnL::InitView()
+{
+ // Sets the clear color
+ glClearColor(0.6f, 0.8f, 1.0f, 1.0f);
+
+ // Enables texturing
+ glEnable(GL_TEXTURE_2D);
+
+ /*
+ Creates the texture.
+ Please refer to the training course "Texturing" for a detailed explanation.
+ */
+ glGenTextures(1, &m_ui32Texture);
+ glBindTexture(GL_TEXTURE_2D, m_ui32Texture);
+ GLuint* pTexData = new GLuint[g_i32TexSize*g_i32TexSize];
+
+ for(int i = 0; i < g_i32TexSize; ++i)
+ {
+ for(int j = 0; j < g_i32TexSize; ++j)
+ {
+ GLuint col = (255<<24) + ((255-j*2)<<16) + ((255-i)<<8) + (255-i*2);
+
+ if ( ((i*j)/8) % 2 )
+ col = 0xffff00ff;
+
+ pTexData[j*g_i32TexSize+i] = col;
+ }
+ }
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, g_i32TexSize, g_i32TexSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+
+ delete[] pTexData;
+
+ // Enables lighting and light 0
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+
+ /*
+ Specifies the light direction.
+ If the 4th component is 0, it's a parallel light (the case here).
+ If the 4th component is not 0, it's a point light.
+ */
+ float aLightPosition[] = {0.0f,0.0f,1.0f,0.0f};
+
+ /*
+ Assigns the light direction to the light number 0.
+ This function allows you to set also the ambiant, diffuse,
+ specular, emission colors of the light as well as attenuation parameters.
+ We keep the other parameters to their default value in this demo.
+ */
+ glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, aLightPosition);
+
+ // Create VBO for the triangle from our data
+
+ // Interleaved vertex data
+ float afVertices[] = { -0.4f,-0.4f,0.0f, // Position
+ 0.0f,0.0f, // UV
+ 0,0,1, // Normal
+ 0.4f,-0.4f,0.0f,
+ 1.0f,0.0f,
+ 0,0,1,
+ 0.0f,0.4f,0.0f,
+ 0.5f,1.0f,
+ 0,0,1};
+
+ glGenBuffers(1, &m_ui32Vbo);
+
+ unsigned int uiSize = 3 * (sizeof(float) * 8); // 3 vertices * stride (8 verttypes per vertex)
+
+ // Bind the VBO
+ glBindBuffer(GL_ARRAY_BUFFER, m_ui32Vbo);
+
+ // Set the buffer's data
+ glBufferData(GL_ARRAY_BUFFER, uiSize, afVertices, GL_STATIC_DRAW);
+
+ // Unbind the VBO
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ return true;
+}
+
+/*!****************************************************************************
+ @Function ReleaseView
+ @Return bool true if no error occured
+ @Description Code in ReleaseView() will be called by PVRShell when the
+ application quits or before a change in the rendering context.
+******************************************************************************/
+bool OGLESBasicTnL::ReleaseView()
+{
+ // Frees the texture
+ glDeleteTextures(1, &m_ui32Texture);
+
+ return true;
+}
+
+/*!****************************************************************************
+ @Function RenderScene
+ @Return bool true if no error occured
+ @Description Main rendering loop function of the program. The shell will
+ call this function every frame.
+ eglSwapBuffers() will be performed by PVRShell automatically.
+ PVRShell will also manage important OS events.
+ Will also manage relevent OS events. The user has access to
+ these events through an abstraction layer provided by PVRShell.
+******************************************************************************/
+bool OGLESBasicTnL::RenderScene()
+{
+ // Clears the color and depth buffer
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ // Model view matrix
+ float aModelView[] =
+ {
+ (float)cos(m_fAngle), 0, (float)sin(m_fAngle), 0,
+ 0, 1, 0, 0,
+ -(float)sin(m_fAngle), 0, (float)cos(m_fAngle), 0,
+ 0, 0, 0, 1
+ };
+
+ // Sets the matrix mode to modify the Model View matrix
+ glMatrixMode(GL_MODELVIEW);
+
+ // Loads our matrix into OpenGL Model View matrix
+ glLoadMatrixf(aModelView);
+
+ // Increments the angle of the view
+ m_fAngle += .02f;
+
+ /*
+ Draw a triangle.
+ Please refer to the training course IntroducingPVRShell for a detailed explanation.
+ */
+
+ // bind the VBO for the triangle
+ glBindBuffer(GL_ARRAY_BUFFER, m_ui32Vbo);
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3,GL_FLOAT,sizeof(float) * 8, 0);
+
+ // Pass the texture coordinates data
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glTexCoordPointer(2,GL_FLOAT,sizeof(float) * 8, (unsigned char*) (sizeof(float) * 3));
+
+ // Pass the normals data
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glNormalPointer(GL_FLOAT,sizeof(float) * 8, (unsigned char*) (sizeof(float) * 5));
+
+ // Draws a non-indexed triangle array
+ glDrawArrays(GL_TRIANGLES, 0, 3);
+
+ // unbind the vertex buffer as we don't need it bound anymore
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+
+ return true;
+}
+
+/*!****************************************************************************
+ @Function NewDemo
+ @Return PVRShell* The demo supplied by the user
+ @Description This function must be implemented by the user of the shell.
+ The user should return its PVRShell object defining the
+ behaviour of the application.
+******************************************************************************/
+PVRShell* NewDemo()
+{
+ return new OGLESBasicTnL();
+}
+
+/******************************************************************************
+ End of file (OGLESBasicTnL.cpp)
+******************************************************************************/
+