Commit 45755df2 by Nicolas Capens Committed by Nicolas Capens

Eliminate the legacy PowerVR SDK

We now have an up-to-date third_party/PowerVR_Examples submodule for these sample applications. Bug: b/141361933 Change-Id: I216b94d0c3263bf85a6b0a7fca52a2e5b7beefa2 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43190 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 3702e01d
...@@ -123,8 +123,7 @@ option_if_not_defined(SWIFTSHADER_GET_PVR "Check out the PowerVR submodule" FALS ...@@ -123,8 +123,7 @@ option_if_not_defined(SWIFTSHADER_GET_PVR "Check out the PowerVR submodule" FALS
option_if_not_defined(SWIFTSHADER_USE_GROUP_SOURCES "Group the source files in a folder tree for Visual Studio" TRUE) option_if_not_defined(SWIFTSHADER_USE_GROUP_SOURCES "Group the source files in a folder tree for Visual Studio" TRUE)
option_if_not_defined(SWIFTSHADER_BUILD_SAMPLES "Build sample programs" TRUE) option_if_not_defined(SWIFTSHADER_BUILD_TESTS "Build unit tests" TRUE)
option_if_not_defined(SWIFTSHADER_BUILD_TESTS "Build test programs" TRUE)
option_if_not_defined(SWIFTSHADER_BUILD_BENCHMARKS "Build benchmarks" FALSE) option_if_not_defined(SWIFTSHADER_BUILD_BENCHMARKS "Build benchmarks" FALSE)
option_if_not_defined(SWIFTSHADER_MSAN "Build with memory sanitizer" FALSE) option_if_not_defined(SWIFTSHADER_MSAN "Build with memory sanitizer" FALSE)
...@@ -1366,47 +1365,6 @@ endif() ...@@ -1366,47 +1365,6 @@ endif()
# Sample programs and tests # Sample programs and tests
########################################################### ###########################################################
if(SWIFTSHADER_BUILD_SAMPLES)
if(WIN32)
add_executable(Legacy_OGLES2HelloAPI ${HELLO2_DIR}/OGLES2HelloAPI_Windows.cpp)
set_target_properties(Legacy_OGLES2HelloAPI PROPERTIES
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include"
COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS}"
COMPILE_DEFINITIONS "GL_GLEXT_PROTOTYPES"
FOLDER "Samples"
)
target_link_libraries(Legacy_OGLES2HelloAPI libEGL libGLESv2)
set_property(TARGET Legacy_OGLES2HelloAPI APPEND_STRING PROPERTY LINK_FLAGS "/SUBSYSTEM:WINDOWS")
set(CMAKE_DEFAULT_STARTUP_PROJECT Legacy_OGLES2HelloAPI)
elseif(LINUX)
add_executable(Legacy_OGLES2HelloAPI ${HELLO2_DIR}/OGLES2HelloAPI_LinuxX11.cpp)
set_target_properties(Legacy_OGLES2HelloAPI PROPERTIES
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include"
COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS}"
COMPILE_DEFINITIONS "GL_GLEXT_PROTOTYPES"
LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
)
target_link_libraries(Legacy_OGLES2HelloAPI dl ${X11} libEGL libGLESv2) # Explicitly link our "lib*" targets, not the platform provided "EGL" and "GLESv2"
elseif(APPLE)
add_executable(Legacy_OGLES2HelloAPI MACOSX_BUNDLE
${HELLO2_DIR}/OGLES2HelloAPI_OSX.mm
${HELLO2_DIR}/Build/OSX/en.lproj/MainMenu.xib
)
set_target_properties(Legacy_OGLES2HelloAPI PROPERTIES
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include"
COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};-Wno-deprecated-declarations" # 'NSTitledWindowMask', 'NSClosableWindowMask' is deprecated
COMPILE_DEFINITIONS "GL_GLEXT_PROTOTYPES"
LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
MACOSX_BUNDLE_INFO_PLIST "${HELLO2_DIR}/Build/OSX/Info.plist"
)
target_link_libraries(Legacy_OGLES2HelloAPI libEGL libGLESv2 ${OS_LIBS})
set_source_files_properties(${HELLO2_DIR}/Build/OSX/en.lproj/MainMenu.xib PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources"
)
endif()
endif(SWIFTSHADER_BUILD_SAMPLES)
if(SWIFTSHADER_BUILD_TESTS) if(SWIFTSHADER_BUILD_TESTS)
set(REACTOR_UNIT_TESTS_LIST set(REACTOR_UNIT_TESTS_LIST
${SOURCE_DIR}/Reactor/ReactorUnitTests.cpp ${SOURCE_DIR}/Reactor/ReactorUnitTests.cpp
......
Subproject commit f42d5525ae2775c6faf13f4b224d81a5ecd290d0 Subproject commit 0a5b48fd1f4ad251f5b4f0e07c46744c4841255b
#ifndef __eglplatform_h_
#define __eglplatform_h_
/*
** Copyright (c) 2007-2009 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Platform-specific types and definitions for egl.h
* $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
* by filing a bug against product "EGL" component "Registry".
*/
#include <KHR/khrplatform.h>
/* Macros used in EGL function prototype declarations.
*
* EGL functions should be prototyped as:
*
* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
*
* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
*/
#ifndef EGLAPI
#define EGLAPI KHRONOS_APICALL
#endif
#ifndef EGLAPIENTRY
#define EGLAPIENTRY KHRONOS_APIENTRY
#endif
#define EGLAPIENTRYP EGLAPIENTRY*
/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
* are aliases of window-system-dependent types, such as X Display * or
* Windows Device Context. They must be defined in platform-specific
* code below. The EGL-prefixed versions of Native*Type are the same
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
*
* Khronos STRONGLY RECOMMENDS that you use the default definitions
* provided below, since these changes affect both binary and source
* portability of applications using EGL running on different EGL
* implementations.
*/
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <windows.h>
typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType;
typedef HWND EGLNativeWindowType;
#elif defined(SUPPORT_X11)
/* X11 (tentative) */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
#elif defined(__ANDROID__) || defined(ANDROID)
#include <android/native_window.h>
struct egl_native_pixmap_t;
typedef struct ANativeWindow* EGLNativeWindowType;
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
typedef void* EGLNativeDisplayType;
#else
#if defined(_WIN64) || __WORDSIZE == 64
typedef khronos_int64_t EGLNativeDisplayType;
#else
typedef int EGLNativeDisplayType;
#endif
typedef void *EGLNativeWindowType;
typedef void *EGLNativePixmapType;
#endif
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
typedef EGLNativeDisplayType NativeDisplayType;
typedef EGLNativePixmapType NativePixmapType;
typedef EGLNativeWindowType NativeWindowType;
/* Define EGLint. This must be a signed integral type large enough to contain
* all legal attribute names and values passed into and out of EGL, whether
* their type is boolean, bitmask, enumerant (symbolic constant), integer,
* handle, or other. While in general a 32-bit integer will suffice, if
* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
* integer type.
*/
typedef khronos_int32_t EGLint;
#endif /* __eglplatform_h */
/*
* Skeleton egl.h to provide compatibility for early GLES 1.0
* applications. Several early implementations included gl.h
* in egl.h leading applications to include only egl.h
*
* $Revision: 6252 $ on $Date:: 2008-08-06 16:35:08 -0700 #$
*/
#ifndef __legacy_egl_h_
#define __legacy_egl_h_
#include <EGL/egl.h>
#include <GLES/gl.h>
#endif /* __legacy_egl_h_ */
#ifndef __glplatform_h_
#define __glplatform_h_
/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/* Platform-specific types and definitions for OpenGL ES 1.X gl.h
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
* by filing a bug against product "OpenGL-ES" component "Registry".
*/
#include <KHR/khrplatform.h>
#ifndef GL_API
#define GL_API KHRONOS_APICALL
#endif
#ifndef GL_APIENTRY
#define GL_APIENTRY KHRONOS_APIENTRY
#endif
#endif /* __glplatform_h_ */
#ifndef __gl2extimg_h_
#define __gl2extimg_h_
#ifdef __cplusplus
extern "C" {
#endif
/*------------------------------------------------------------------------*
* IMG extension tokens
*------------------------------------------------------------------------*/
/* GL_IMG_binary_shader */
#ifndef GL_IMG_binary_shader
#define GL_SGX_BINARY_IMG 0x8C0A
#endif
/* GL_IMG_texture_compression_pvrtc */
#ifndef GL_IMG_texture_compression_pvrtc
#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
#endif
#ifndef GL_IMG_texture_compression_pvrtc2
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
#endif
/* GL_IMG_texture_format_BGRA8888 */
#define GL_BGRA 0x80E1
/*------------------------------------------------------------------------*
* IMG extension functions
*------------------------------------------------------------------------*/
/* GL_IMG_binary_shader */
#ifndef GL_IMG_binary_shader
#define GL_IMG_binary_shader 1
#endif
/* GL_IMG_texture_compression_pvrtc */
#ifndef GL_IMG_texture_compression_pvrtc
#define GL_IMG_texture_compression_pvrtc 1
#endif
#ifndef GL_IMG_texture_compression_pvrtc2
#define GL_IMG_texture_compression_pvrtc2 1
#endif
#ifdef __cplusplus
}
#endif
#endif /* __gl2extimg_h_ */
#ifndef __gl2platform_h_
#define __gl2platform_h_
/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
* by filing a bug against product "OpenGL-ES" component "Registry".
*/
#include <KHR/khrplatform.h>
#ifndef GL_APICALL
#define GL_APICALL KHRONOS_APICALL
#endif
#ifndef GL_APIENTRY
#define GL_APIENTRY KHRONOS_APIENTRY
#endif
#endif /* __gl2platform_h_ */
#ifndef __gl3ext_h_
#define __gl3ext_h_
/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/* OpenGL ES 3 Extensions
*
* After an OES extension's interactions with OpenGl ES 3.0 have been documented,
* its tokens and function definitions should be added to this file in a manner
* that does not conflict with gl2ext.h or gl3.h.
*
* Tokens and function definitions for extensions that have become standard
* features in OpenGL ES 3.0 will not be added to this file.
*
* Applications using OpenGL-ES-2-only extensions should include gl2ext.h
*/
#endif /* __gl3ext_h_ */
#ifndef __gl3platform_h_
#define __gl3platform_h_
/* $Revision: 18437 $ on $Date:: 2012-07-08 23:31:39 -0700 #$ */
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/* Platform-specific types and definitions for OpenGL ES 3.X gl3.h
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
* by filing a bug against product "OpenGL-ES" component "Registry".
*/
#include <KHR/khrplatform.h>
#ifndef GL_APICALL
#define GL_APICALL KHRONOS_APICALL
#endif
#ifndef GL_APIENTRY
#define GL_APIENTRY KHRONOS_APIENTRY
#endif
#endif /* __gl3platform_h_ */
/*!***********************************************************************
@file PVRScopeStats.h
@copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved.
@brief PVRScopeStats header file. @copybrief ScopeStats
**************************************************************************/
/*! @mainpage PVRScope
@section overview Library Overview
*****************************
PVRScope is a utility library which has two functionalities:
\li @ref ScopeStats is used to access the hardware performance counters in
PowerVR hardware via a driver library called PVRScopeServices.
\li @ref ScopeComms allows an application to send user defined information to
PVRTune via PVRPerfServer, both as counters and marks, or as editable data that can be
passed back to the application.
PVRScope is supplied in the PVRScope.h header file. Your application also needs to link to the PVRScope
library file, either a <tt>.lib</tt>, <tt>.so</tt>, or <tt>.dy</tt> file, depending on your platform.
For more information on PVRScope, see the <em>PVRScope User Manual</em>.
@subsection limitStats PVRScopeStats Limitations
*****************************
@copydetails ScopeStats
@subsection limitComms PVRScopeComms Limitations
*****************************
@copydetails ScopeComms
*/
#ifndef _PVRSCOPE_H_
#define _PVRSCOPE_H_
#ifdef __cplusplus
extern "C" {
#endif
/*!
@addtogroup ScopeStats PVRScopeStats
@brief The PVRScopeStats functionality of PVRScope is used to access the hardware performance counters in
PowerVR hardware via a driver library called PVRScopeServices.
@details PVRScopeStats has the following limitations:
\li Only one instance of @ref ScopeStats may communicate with PVRScopeServices at any
given time. If a PVRScope enabled application attempts to communicate with
PVRScopeServices at the same time as another such application, or at the same time as
PVRPerfServer, conflicts can occur that may make performance data unreliable.
\li Performance counters can only be read on devices whose drivers have been built with
hardware profiling enabled. This configuration is the default in most production drivers due to negligible overhead.
\li Performance counters contain the average value of that counter since the last time the counter was interrogated.
@{
*/
/****************************************************************************
** Enums
****************************************************************************/
/*!**************************************************************************
@enum EPVRScopeInitCode
@brief PVRScope initialisation return codes.
****************************************************************************/
enum EPVRScopeInitCode
{
ePVRScopeInitCodeOk, ///< Initialisation OK
ePVRScopeInitCodeOutOfMem, ///< Out of memory
ePVRScopeInitCodeDriverSupportNotFound, ///< Driver support not found
ePVRScopeInitCodeDriverSupportInsufficient, ///< Driver support insufficient
ePVRScopeInitCodeDriverSupportInitFailed, ///< Driver support initialisation failed
ePVRScopeInitCodeDriverSupportQueryInfoFailed, ///< Driver support information query failed
ePVRScopeInitCodeUnrecognisedHW ///< Unrecognised hardware
};
/****************************************************************************
** Structures
****************************************************************************/
// Internal implementation data
struct SPVRScopeImplData;
/*!**************************************************************************
@struct SPVRScopeCounterDef
@brief Definition of a counter that PVRScope calculates.
****************************************************************************/
struct SPVRScopeCounterDef
{
const char *pszName; ///< Counter name, null terminated
bool bPercentage; ///< true if the counter is a percentage
unsigned int nGroup; ///< The counter group that the counter is in.
};
/*!**************************************************************************
@struct SPVRScopeCounterReading
@brief A set of return values resulting from querying the counter values.
****************************************************************************/
struct SPVRScopeCounterReading
{
float *pfValueBuf; ///< Array of returned values
unsigned int nValueCnt; ///< Number of values set in the above array
unsigned int nReadingActiveGroup; ///< Group that was active when counters were sampled
};
/*!**************************************************************************
@struct SPVRScopeGetInfo
@brief A set of return values holding miscellaneous PVRScope information.
****************************************************************************/
struct SPVRScopeGetInfo
{
unsigned int nGroupMax; ///< Highest group number of any counter
};
/****************************************************************************
** Declarations
****************************************************************************/
const char *PVRScopeGetDescription(); ///< Query the PVRScope library description
/*!**************************************************************************
@brief Initialise @ref ScopeStats, to access the HW performance counters in PowerVR.
@return EPVRScopeInitCodeOk on success.
****************************************************************************/
EPVRScopeInitCode PVRScopeInitialise(
SPVRScopeImplData **ppsData ///< Context data
);
/*!**************************************************************************
@brief Shutdown or de-initalise @ref ScopeStats and free the allocated memory.
***************************************************************************/
void PVRScopeDeInitialise(
SPVRScopeImplData **ppsData, ///< Context data
SPVRScopeCounterDef **ppsCounters, ///< Array of counters
SPVRScopeCounterReading * const psReading ///< Results memory area
);
/*!**************************************************************************
@brief Query for @ref ScopeStats information. This function should only be called during initialisation.
****************************************************************************/
void PVRScopeGetInfo(
SPVRScopeImplData * const psData, ///< Context data
SPVRScopeGetInfo * const psInfo ///< Returned information
);
/*!**************************************************************************
@brief Query for the list of @ref ScopeStats HW performance counters, and
allocate memory in which the counter values will be received. This function
should only be called during initialisation.
****************************************************************************/
bool PVRScopeGetCounters(
SPVRScopeImplData * const psData, ///< Context data
unsigned int * const pnCount, ///< Returned number of counters
SPVRScopeCounterDef **ppsCounters, ///< Returned counter array
SPVRScopeCounterReading * const psReading ///< Pass a pointer to the structure to be initialised
);
/*!**************************************************************************
@brief This function should be called regularly, such as once per frame. psReading
may be NULL until a new reading is required, in order to smooth out values
across longer time periods, perhaps a number of frames.
@details As and when desired, call this function to fill the counter-value array with
the current counter values then change the active performance counter
group. In a 3D application, you might call this once per frame or every N
frames. Typically the group ID should be 0xffffffff in order to leave the
active group unchanged; if it is desired to change it then pass the new
group ID.
****************************************************************************/
bool PVRScopeReadCountersThenSetGroup(
SPVRScopeImplData * const psData, ///< Context data
SPVRScopeCounterReading * const psReading, ///< Returned data will be filled into the pointed-to structure
const unsigned int nTimeUS, ///< Current time, in microseconds. Ignored if psReading is NULL.
const unsigned int nGroup ///< New group; 0xffffffff to leave it unchanged
);
/*! @} */
#ifdef __cplusplus
}
#endif
#endif /* _PVRSCOPE_H_ */
/*****************************************************************************
End of file (PVRScopeStats.h)
*****************************************************************************/
/*!***************************************************************************
@File sdkver.h
@Title Version numbers and strings.
@Date 08/11/2011
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Platform Independant
@Description Version numbers and strings for SDK components.
*****************************************************************************/
#ifndef __SDKVER_H_
#define __SDKVER_H_
/*!***************************************************************************
Defines
*****************************************************************************/
#define PVRSDK_VERSION "3.2@2654748"
#define PVRVERSION_MAJ "3"
#define PVRVERSION_MIN "2"
#define PVRVERSION_BRANCH "32"
#define PVRVERSION_BRANCH_DEC "3.2"
#define PVRVERSION_BRANCH_NAME "REL/3.2"
#define PVRVERSION_BUILD "2654748"
#define PVRVERSION_BUILD_HI "265"
#define PVRVERSION_BUILD_LO "4748"
#define PVRSDK_COPYRIGHT_TXT "Copyright (c) Imagination Technologies Ltd. All Rights Reserved."
#endif /* __SDKVER_H_ */
/*****************************************************************************
End of file (sdkver.h)
*****************************************************************************/
//{{NO_DEPENDENCIES}}
// Microsoft eMbedded Visual C++ generated include file.
// Used by shared.rc
//
#define IDR_CEUX1 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
//Microsoft eMbedded Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
ICON ICON DISCARDABLE "sdk.ico"
/////////////////////////////////////////////////////////////////////////////
//
// CEUX
//
HI_RES_AWARE CEUX DISCARDABLE
BEGIN
0x0100
END
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
:Title:
ChameleonMan
:ShortDescription:
This demo shows a matrix skinned character in combination with bump mapping.
:FullDescription:
The ChameleonMan demo shows a Matrix Skinned Character in combination with bump mapping.
Matrix Skinning is the act of animating a vertex over time given a set (palette) of matrices and a known set of blend weights assigned to those matrices. The ChameleonMan model has 19 bones and an animation cycle of 16 frames.
For each frame the Matrix Palette is recomputed based on time. For example to render the model at time point 5.25 the application would linearly blend between the matrices stored for frame 5 and 6 using weights of 0.75 and 0.25 respectively.
Per vertex, up to 3 matrices, from the palette, along with 3 weights are used by the vertex shader to update the vertex position to obtain the current animation frame position.
Two lighting modes are available:
- per vertex lighting
- bump mapped lighting
Controls:
- 1 - Toggle lighting modes
- Esc - Close the application
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Content Files">
<UniqueIdentifier>{900022e4-757a-46fb-bd53-6dfc20b3d893}</UniqueIdentifier>
</Filter>
<Filter Include="Content Files\Scene Files">
<UniqueIdentifier>{2c3d4c8c-5d1a-459a-a05a-a4e4b608a44e}</UniqueIdentifier>
<Extensions>pod</Extensions>
</Filter>
<Filter Include="Content Files\Shaders">
<UniqueIdentifier>{2c3d4c8c-5d1a-459a-a05a-a4e4b608a44e}</UniqueIdentifier>
<Extensions>fsh;psh;glsl;frag;vert</Extensions>
</Filter>
<Filter Include="Content Files\Textures">
<UniqueIdentifier>{2c3d4c8c-5d1a-459a-a05a-a4e4b608a44e}</UniqueIdentifier>
<Extensions>ico;bmp;gif;jpg;jpeg;jpe;tiff;tif;png;pvr</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\..\..\..\Shell\PVRShell.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\..\..\Shell\PVRShellImpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\..\..\Shell\API\KEGL\PVRShellAPI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\..\..\Shell\OS\Windows\PVRShellOS.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\..\..\Builds\Windows\Resources\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\..\..\..\..\Builds\Windows\Resources\shared.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\OGLES2ChameleonMan.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\..\Shell\PVRShell.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\..\Shell\API\KEGL\PVRShellAPI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\..\Shell\OS\Windows\PVRShellOS.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\skyline.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\Wall_diffuse_baked.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\Tang_space_BodyMap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\Tang_space_LegsMap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\Tang_space_BeltMap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\FinalChameleonManLegs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\FinalChameleonManHeadBody.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\lamp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\ChameleonBelt.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\SkinnedVertShader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\SkinnedFragShader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\DefaultVertShader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\DefaultFragShader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Content\ChameleonScene.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\ChameleonScene.pod">
<Filter>Content Files\Scene Files</Filter>
</CustomBuild>
<CustomBuild Include="..\..\skyline.pvr">
<Filter>Content Files\Textures</Filter>
</CustomBuild>
<CustomBuild Include="..\..\Wall_diffuse_baked.pvr">
<Filter>Content Files\Textures</Filter>
</CustomBuild>
<CustomBuild Include="..\..\FinalChameleonManLegs.pvr">
<Filter>Content Files\Textures</Filter>
</CustomBuild>
<CustomBuild Include="..\..\Tang_space_LegsMap.pvr">
<Filter>Content Files\Textures</Filter>
</CustomBuild>
<CustomBuild Include="..\..\Tang_space_BodyMap.pvr">
<Filter>Content Files\Textures</Filter>
</CustomBuild>
<CustomBuild Include="..\..\lamp.pvr">
<Filter>Content Files\Textures</Filter>
</CustomBuild>
<CustomBuild Include="..\..\ChameleonBelt.pvr">
<Filter>Content Files\Textures</Filter>
</CustomBuild>
<CustomBuild Include="..\..\FinalChameleonManHeadBody.pvr">
<Filter>Content Files\Textures</Filter>
</CustomBuild>
<CustomBuild Include="..\..\Tang_space_BeltMap.pvr">
<Filter>Content Files\Textures</Filter>
</CustomBuild>
<CustomBuild Include="..\..\SkinnedVertShader.vsh">
<Filter>Content Files\Shaders</Filter>
</CustomBuild>
<CustomBuild Include="..\..\SkinnedFragShader.fsh">
<Filter>Content Files\Shaders</Filter>
</CustomBuild>
<CustomBuild Include="..\..\DefaultVertShader.vsh">
<Filter>Content Files\Shaders</Filter>
</CustomBuild>
<CustomBuild Include="..\..\DefaultFragShader.fsh">
<Filter>Content Files\Shaders</Filter>
</CustomBuild>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
\ No newline at end of file
// This file was created by Filewrap 1.1
// Little endian mode
// DO NOT EDIT
#include "../PVRTMemoryFileSystem.h"
// using 32 bit to guarantee alignment.
#ifndef A32BIT
#define A32BIT static const unsigned int
#endif
// ******** Start: ChameleonBelt.pvr ********
// File data
A32BIT _ChameleonBelt_pvr[] = {
0x3525650,0x0,0x3,0x0,0x0,0x0,0x20,0x20,0x1,0x1,0x1,0x6,0xf,0x3525650,0x3,0x3,0xeb000200,0x60020201,0x3e6a4e2,0x60035703,0xffe281e2,0x60101010,0x10e281e2,0x61545554,0x3e280e2,0x80030303,0x3e682e2,0x60030303,0x54e682e2,0x60949094,0x94e280e2,0x60949594,0xffe280e2,0x80000000,0xe682e2,0x60a95545,0xffe280e2,0x60000000,0x10e682e2,0x60aa5555,0xaae280e2,0x40aaaaaa,0xaae680de,0x40aaaaaa,0xaae680de,0x40aaaaaa,0xaae680de,0x40aaaaaa,0x3e680de,0x80030303,0x3e682e2,0x60030303,0x94e682e2,0x60949094,0x94e280e2,0x60949594,0x3e280e2,0x80030303,0x3e682e2,0x60ff0203,0x54e282e2,0x60545094,0x50e280e2,0x60ff0000,
0xaae682e2,0x40aaaaaa,0xaae680de,0x40aaaaaa,0xaae680de,0x40aaaaaa,0xaae680de,0x40aaaaaa,0xaae680de,0x605555a9,0x15e280e2,0x60ff0000,0x55e682e2,0x61005555,0xe280e2,0x80ff0000,0xffe682e2,0x80000000,0xe682e2,0x60aa5545,0xffe280e2,0x60000000,0x10e682e2,0x60aa5555,0xaae280e2,0x40aaaaaa,0xaae680de,0x40aaaaaa,0xaae680de,0x40aaaaaa,0xaae680de,0x40aaaaaa,0xffe680de,0x80000000,0xe682e2,0x60595505,0xeae280e2,0x60808040,0x80e6a4e2,0x60c1c1c0,0x55e682e2,0x61555555,0x15e280e2,0x61151515,0xc1e280e2,0x60c0c1c1,0xc0e682e2,0x80c0c0c0,0xaae682e2,0x60aa9aaa,0xaae280e2,0x40aaaaaa,0xaae680de,0x40aaaaaa,0xaae680de,0x40aaaaaa,0x55e680de,0x61545555,0x10e280e2,0x60ff0000,0x55e682e2,0x61005555,0xe280e2,0x80ff0000,
0x15e682e2,0x61555555,0x15e280e2,0x61151515,0xc0e280e2,0x60c0c1c0,0xc0e682e2,0x80c0c0c0,0x56e682e2,0x60555559,0x10e280e2,0x60ff0000,0xc0e682e2,0x60c0c1c0,0xc0e682e2,0x60ea8080,0xabe6a4e2,0x80020202,0x2e682e2,0x60030202,0xfee282e2,0x60001000,0xe281e2,0x81545450,0x3e260e2,0x81030303,0x3e281e2,0x61010101,0x60e682e2,0x60505480,0xe280e2,0x81000000,0xffe281e2,0x81000000,0xe281e2,0x60595211,0xaae280e2,0x60000000,0xe282e2,0x81000000,0x56e281e2,0x60555595,0x55e680e2,0x60000000,0x1e261e2,0x61051d0d,0xe260e2,0x80000000,0x77e682e2,0x8131d711,0x1e260e2,0x61010101,0x55e281e2,0x61000000,0xe281e2,0x61000000,0x56e682e2,0x60555555,0x56e280e2,0x60450145,0x56e281e2,0x60450145,0x56e281e2,0x60555555,
0xaae280e2,0x609a569a,0xaae280e2,0x60baeeba,0xaae260e2,0x60baeeba,0xaae260e2,0x609a569a,0xaae280e2,0x40aaaaaa,0xaae280e2,0x40aaaaaa,0xaae280e2,0x40aaaaaa,0xaae280e2,0x40aaaaaa,0xe280e2,
};
// Register ChameleonBelt.pvr in memory file system at application startup time
static CPVRTMemoryFileSystem RegisterFile_ChameleonBelt_pvr("ChameleonBelt.pvr", _ChameleonBelt_pvr, 835);
// ******** End: ChameleonBelt.pvr ********
This source diff could not be displayed because it is too large. You can view the blob instead.
// This file was created by Filewrap 1.1
// Little endian mode
// DO NOT EDIT
#include "../PVRTMemoryFileSystem.h"
// using 32 bit to guarantee alignment.
#ifndef A32BIT
#define A32BIT static const unsigned int
#endif
// ******** Start: DefaultFragShader.fsh ********
// File data
static const char _DefaultFragShader_fsh[] =
"uniform sampler2D sTexture;\n"
"\n"
"varying mediump vec2 TexCoord;\n"
"\n"
"void main()\n"
"{\n"
" gl_FragColor = texture2D(sTexture, TexCoord);\n"
"}\n";
// Register DefaultFragShader.fsh in memory file system at application startup time
static CPVRTMemoryFileSystem RegisterFile_DefaultFragShader_fsh("DefaultFragShader.fsh", _DefaultFragShader_fsh, 128);
// ******** End: DefaultFragShader.fsh ********
// This file was created by Filewrap 1.1
// Little endian mode
// DO NOT EDIT
#include "../PVRTMemoryFileSystem.h"
// using 32 bit to guarantee alignment.
#ifndef A32BIT
#define A32BIT static const unsigned int
#endif
// ******** Start: DefaultVertShader.vsh ********
// File data
static const char _DefaultVertShader_vsh[] =
"attribute highp vec3 inVertex;\n"
"attribute mediump vec2 inTexCoord;\n"
"\n"
"uniform highp mat4 MVPMatrix;\n"
"uniform float\tfUOffset;\n"
"\n"
"varying mediump vec2 TexCoord;\n"
"\n"
"void main()\n"
"{\n"
"\tgl_Position = MVPMatrix * vec4(inVertex, 1.0);\n"
"\n"
"\t// Pass through texcoords\n"
"\tTexCoord = inTexCoord;\n"
"\tTexCoord.x += fUOffset;\n"
"}\n"
" ";
// Register DefaultVertShader.vsh in memory file system at application startup time
static CPVRTMemoryFileSystem RegisterFile_DefaultVertShader_vsh("DefaultVertShader.vsh", _DefaultVertShader_vsh, 301);
// ******** End: DefaultVertShader.vsh ********
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
// This file was created by Filewrap 1.1
// Little endian mode
// DO NOT EDIT
#include "../PVRTMemoryFileSystem.h"
// using 32 bit to guarantee alignment.
#ifndef A32BIT
#define A32BIT static const unsigned int
#endif
// ******** Start: SkinnedFragShader.fsh ********
// File data
static const char _SkinnedFragShader_fsh[] =
"uniform sampler2D sTexture;\n"
"uniform sampler2D sNormalMap;\n"
"uniform bool bUseDot3;\n"
"\n"
"varying mediump vec2 TexCoord;\n"
"varying mediump vec3 Light;\n"
"\n"
"void main()\n"
"{\n"
"\tif(bUseDot3)\n"
"\t{\n"
"\t\t/*\n"
"\t\t\tNote:\n"
"\t\t\tIn the normal map red = y, green = x, blue = z which is why when we get the normal\n"
"\t\t\tfrom the texture we use the swizzle .grb so the colours are mapped to the correct\n"
"\t\t\tco-ordinate variable.\n"
"\t\t*/\n"
"\n"
"\t\tmediump vec3 fNormal = texture2D(sNormalMap, TexCoord).grb;\n"
"\t\tmediump float fNDotL = dot((fNormal - 0.5) * 2.0, Light);\n"
"\t\t\n"
"\t\tgl_FragColor = texture2D(sTexture, TexCoord) * fNDotL;\n"
" }\n"
" else\n"
"\t\tgl_FragColor = texture2D(sTexture, TexCoord) * Light.x;\n"
"}\n";
// Register SkinnedFragShader.fsh in memory file system at application startup time
static CPVRTMemoryFileSystem RegisterFile_SkinnedFragShader_fsh("SkinnedFragShader.fsh", _SkinnedFragShader_fsh, 646);
// ******** End: SkinnedFragShader.fsh ********
// This file was created by Filewrap 1.1
// Little endian mode
// DO NOT EDIT
#include "../PVRTMemoryFileSystem.h"
// using 32 bit to guarantee alignment.
#ifndef A32BIT
#define A32BIT static const unsigned int
#endif
// ******** Start: SkinnedVertShader.vsh ********
// File data
static const char _SkinnedVertShader_vsh[] =
"/*\n"
"\tIf the current vertex is affected by bones then the vertex position and\n"
"\tnormal will be transformed by the bone matrices. Each vertex wil have up \n"
"\tto 4 bone indices (inBoneIndex) and bone weights (inBoneWeights).\n"
"\t\n"
"\tThe indices are used to index into the array of bone matrices \n"
"\t(BoneMatrixArray) to get the required bone matrix for transformation. The \n"
"\tamount of influence a particular bone has on a vertex is determined by the\n"
"\tweights which should always total 1. So if a vertex is affected by 2 bones \n"
"\tthe vertex position in world space is given by the following equation:\n"
"\n"
"\tposition = (BoneMatrixArray[Index0] * inVertex) * Weight0 + \n"
"\t (BoneMatrixArray[Index1] * inVertex) * Weight1\n"
"\n"
"\tThe same proceedure is applied to the normals but the translation part of \n"
"\tthe transformation is ignored.\n"
"\n"
"\tAfter this the position is multiplied by the view and projection matrices \n"
"\tonly as the bone matrices already contain the model transform for this \n"
"\tparticular mesh. The two-step transformation is required because lighting \n"
"\twill not work properly in clip space.\n"
"*/\n"
"\n"
"attribute highp vec3 inVertex;\n"
"attribute mediump vec3 inNormal;\n"
"attribute mediump vec3 inTangent;\n"
"attribute mediump vec3 inBiNormal;\n"
"attribute mediump vec2 inTexCoord;\n"
"attribute mediump vec4 inBoneIndex;\n"
"attribute mediump vec4 inBoneWeights;\n"
"\n"
"uniform highp mat4 ViewProjMatrix;\n"
"uniform mediump vec3 LightPos;\n"
"uniform mediump\tint\t BoneCount;\n"
"uniform highp mat4 BoneMatrixArray[8];\n"
"uniform highp mat3 BoneMatrixArrayIT[8];\n"
"uniform bool\tbUseDot3;\n"
"\n"
"varying mediump vec3 Light;\n"
"varying mediump vec2 TexCoord;\n"
"\n"
"void main()\n"
"{\n"
"\tif(BoneCount > 0)\n"
"\t{\n"
"\t\t// On PowerVR SGX it is possible to index the components of a vector\n"
"\t\t// with the [] operator. However this can cause trouble with PC\n"
"\t\t// emulation on some hardware so we \"rotate\" the vectors instead.\n"
"\t\tmediump ivec4 boneIndex = ivec4(inBoneIndex);\n"
"\t\tmediump vec4 boneWeights = inBoneWeights;\n"
"\t\n"
"\t\thighp mat4 boneMatrix = BoneMatrixArray[boneIndex.x];\n"
"\t\tmediump mat3 normalMatrix = BoneMatrixArrayIT[boneIndex.x];\n"
"\t\n"
"\t\thighp vec4 position = boneMatrix * vec4(inVertex, 1.0) * boneWeights.x;\n"
"\t\tmediump vec3 worldNormal = normalMatrix * inNormal * boneWeights.x;\n"
"\t\t\n"
"\t\tmediump vec3 worldTangent;\n"
"\t\tmediump vec3 worldBiNormal;\n"
"\t\t\n"
"\t\tif(bUseDot3)\n"
"\t\t{\n"
"\t\t\tworldTangent = normalMatrix * inTangent * boneWeights.x;\n"
"\t\t\tworldBiNormal = normalMatrix * inBiNormal * boneWeights.x;\n"
"\t\t}\n"
"\t\n"
"\t\tfor (lowp int i = 1; i < 3; ++i)\n"
"\t\t{\n"
"\t\t\tif(i < BoneCount)\n"
"\t\t\t{\n"
"\t\t\t\t// \"rotate\" the vector components\n"
"\t\t\t\tboneIndex = boneIndex.yzwx;\n"
"\t\t\t\tboneWeights = boneWeights.yzwx;\n"
"\t\t\t\n"
"\t\t\t\tboneMatrix = BoneMatrixArray[boneIndex.x];\n"
"\t\t\t\tnormalMatrix = BoneMatrixArrayIT[boneIndex.x];\n"
"\n"
"\t\t\t\tposition += boneMatrix * vec4(inVertex, 1.0) * boneWeights.x;\n"
"\t\t\t\tworldNormal += normalMatrix * inNormal * boneWeights.x;\n"
"\t\t\t\t\n"
"\t\t\t\tif(bUseDot3)\n"
"\t\t\t\t{\n"
"\t\t\t\t\tworldTangent += normalMatrix * inTangent * boneWeights.x;\n"
"\t\t\t\t\tworldBiNormal += normalMatrix * inBiNormal * boneWeights.x;\n"
"\t\t\t\t}\n"
"\t\t\t}\n"
"\t\t}\t\t\n"
"\t\tgl_Position = ViewProjMatrix * position;\n"
"\t\t\n"
"\t\t// lighting\n"
"\t\tmediump vec3 TmpLightDir = normalize(LightPos - position.xyz);\n"
"\t\t\n"
"\t\tif(bUseDot3)\n"
"\t\t{\n"
"\t\t\tLight.x = dot(normalize(worldTangent), TmpLightDir);\n"
"\t\t\tLight.y = dot(normalize(worldBiNormal), TmpLightDir);\n"
"\t\t\tLight.z = dot(normalize(worldNormal), TmpLightDir);\n"
"\t\t}\n"
"\t\telse\n"
"\t\t{\n"
"\t\t\tLight.x = dot(normalize(worldNormal), TmpLightDir);\n"
"\t\t}\n"
"\t}\n"
"\n"
"\t\n"
"\t// Pass through texcoords\n"
"\tTexCoord = inTexCoord;\n"
"}\n"
" ";
// Register SkinnedVertShader.vsh in memory file system at application startup time
static CPVRTMemoryFileSystem RegisterFile_SkinnedVertShader_vsh("SkinnedVertShader.vsh", _SkinnedVertShader_vsh, 3431);
// ******** End: SkinnedVertShader.vsh ********
// This file was created by Filewrap 1.1
// Little endian mode
// DO NOT EDIT
#include "../PVRTMemoryFileSystem.h"
// using 32 bit to guarantee alignment.
#ifndef A32BIT
#define A32BIT static const unsigned int
#endif
// ******** Start: Tang_space_BeltMap.pvr ********
// File data
A32BIT _Tang_space_BeltMap_pvr[] = {
0x3525650,0x0,0x3,0x0,0x0,0x0,0x20,0x20,0x1,0x1,0x1,0x1,0xf,0x3525650,0x3,0x3,0x16000200,0x1ce730b8,0x8ec61ebe,0x1cce3c77,0x47c1dfba,0x3e1b6754,0x46d1fdb6,0x1efcaec1,0x73c9ffb6,0xbee7994a,0x61c25ebd,0xde622bed,0xefbe5fc5,0x9c3999af,0x75be5fbd,0x3fddfc43,0x61c5feb6,0xde8071de,0x54c25dc1,0x1e5aaa42,0xf8ce1eb6,0xfce988a7,0xa8be3fc9,0xbcefa025,0xb6ba5fc9,0xde50a571,0x5bc27ebd,0xfe9f826a,0x89c63ebd,0xfe0bb81f,0xf3c21fbd,0xfc6f5e56,0x7aca1fb1,0xde955ad8,0x65ba3fcd,0xdc6b2757,0x3dc23fbd,0xdebbf24e,0x42c21fbd,0xbe849434,0xcbc27fc1,0xfc506636,0x58be7fc1,0xbe964f65,0x11c65eb9,0xde89406d,0x75be5fc1,0xbeac2466,
0xd1ba9ec9,0x3c4a6b90,0x10ce1fb6,0xdf174df5,0xe3c63ebd,0x3e6b1d08,0x5bc19ebe,0x3e06ef7e,0xb9c5ddbe,0x9c7fbbc7,0x7dc25ebd,0xfe0d8a75,0x1be1fc9,0x1e41261e,0x93ca1fba,0x9e8f6b1c,0x4dc25db9,0x7c4ff7e6,0x1abe3fc5,0x1cd9cf3d,0x85c1ffc2,0x5e73a90c,0x77c61fba,0x1f5f4441,0xa0cdfeb6,0xdcf08bd5,0xc7c67eb9,0x1e6a3999,0x7bca1eb6,0x9eccfae1,0xc7be1fc9,0xde1f6abd,0xebc61db5,0x9c3e25bf,0x47be3fc5,0x7e255ced,0x68cddeb6,0xfe1720ca,0xb9c67fbd,0xfec20792,0x77c23eb9,0xbe994ef8,0x81c23ebd,0x3edc462d,0x6ace1fb6,0xdcedabe1,0x76c61fb1,0xbc55c6c4,0x57c21fb9,0xfea26a85,0x25ce3db9,0x3ee367aa,0x3fc5ffb6,0xbece88d4,0xf3be3fc1,0xdc3e74b4,0xdfc21fb9,0x1ec0fa7b,0xf3c5ffb6,0xdc126a65,0xbfc27fc1,0xfee800be,0x77c61db5,0xbe4e2595,
0xb3c63fbd,0xdea5494a,0x5db67ec1,0xde5bda6c,0xadbe3fc5,0x9ce3b6a2,0x75c23fbd,0xbc5897a8,0x8ac25ebd,0x1e61555e,0x6bcdfeb2,0xbafaccfa,0x7eb9ffc5,0xde84f22f,0x10c61ebd,0x5e1cabeb,0xcdfeae,
};
// Register Tang_space_BeltMap.pvr in memory file system at application startup time
static CPVRTMemoryFileSystem RegisterFile_Tang_space_BeltMap_pvr("Tang_space_BeltMap.pvr", _Tang_space_BeltMap_pvr, 579);
// ******** End: Tang_space_BeltMap.pvr ********
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
uniform sampler2D sTexture;
varying mediump vec2 TexCoord;
void main()
{
gl_FragColor = texture2D(sTexture, TexCoord);
}
attribute highp vec3 inVertex;
attribute mediump vec2 inTexCoord;
uniform highp mat4 MVPMatrix;
uniform float fUOffset;
varying mediump vec2 TexCoord;
void main()
{
gl_Position = MVPMatrix * vec4(inVertex, 1.0);
// Pass through texcoords
TexCoord = inTexCoord;
TexCoord.x += fUOffset;
}
\ No newline at end of file
uniform sampler2D sTexture;
uniform sampler2D sNormalMap;
uniform bool bUseDot3;
varying mediump vec2 TexCoord;
varying mediump vec3 Light;
void main()
{
if(bUseDot3)
{
/*
Note:
In the normal map red = y, green = x, blue = z which is why when we get the normal
from the texture we use the swizzle .grb so the colours are mapped to the correct
co-ordinate variable.
*/
mediump vec3 fNormal = texture2D(sNormalMap, TexCoord).grb;
mediump float fNDotL = dot((fNormal - 0.5) * 2.0, Light);
gl_FragColor = texture2D(sTexture, TexCoord) * fNDotL;
}
else
gl_FragColor = texture2D(sTexture, TexCoord) * Light.x;
}
/*
If the current vertex is affected by bones then the vertex position and
normal will be transformed by the bone matrices. Each vertex wil have up
to 4 bone indices (inBoneIndex) and bone weights (inBoneWeights).
The indices are used to index into the array of bone matrices
(BoneMatrixArray) to get the required bone matrix for transformation. The
amount of influence a particular bone has on a vertex is determined by the
weights which should always total 1. So if a vertex is affected by 2 bones
the vertex position in world space is given by the following equation:
position = (BoneMatrixArray[Index0] * inVertex) * Weight0 +
(BoneMatrixArray[Index1] * inVertex) * Weight1
The same proceedure is applied to the normals but the translation part of
the transformation is ignored.
After this the position is multiplied by the view and projection matrices
only as the bone matrices already contain the model transform for this
particular mesh. The two-step transformation is required because lighting
will not work properly in clip space.
*/
attribute highp vec3 inVertex;
attribute mediump vec3 inNormal;
attribute mediump vec3 inTangent;
attribute mediump vec3 inBiNormal;
attribute mediump vec2 inTexCoord;
attribute mediump vec4 inBoneIndex;
attribute mediump vec4 inBoneWeights;
uniform highp mat4 ViewProjMatrix;
uniform mediump vec3 LightPos;
uniform mediump int BoneCount;
uniform highp mat4 BoneMatrixArray[8];
uniform highp mat3 BoneMatrixArrayIT[8];
uniform bool bUseDot3;
varying mediump vec3 Light;
varying mediump vec2 TexCoord;
void main()
{
if(BoneCount > 0)
{
// On PowerVR SGX it is possible to index the components of a vector
// with the [] operator. However this can cause trouble with PC
// emulation on some hardware so we "rotate" the vectors instead.
mediump ivec4 boneIndex = ivec4(inBoneIndex);
mediump vec4 boneWeights = inBoneWeights;
highp mat4 boneMatrix = BoneMatrixArray[boneIndex.x];
mediump mat3 normalMatrix = BoneMatrixArrayIT[boneIndex.x];
highp vec4 position = boneMatrix * vec4(inVertex, 1.0) * boneWeights.x;
mediump vec3 worldNormal = normalMatrix * inNormal * boneWeights.x;
mediump vec3 worldTangent;
mediump vec3 worldBiNormal;
if(bUseDot3)
{
worldTangent = normalMatrix * inTangent * boneWeights.x;
worldBiNormal = normalMatrix * inBiNormal * boneWeights.x;
}
for (lowp int i = 1; i < 3; ++i)
{
if(i < BoneCount)
{
// "rotate" the vector components
boneIndex = boneIndex.yzwx;
boneWeights = boneWeights.yzwx;
boneMatrix = BoneMatrixArray[boneIndex.x];
normalMatrix = BoneMatrixArrayIT[boneIndex.x];
position += boneMatrix * vec4(inVertex, 1.0) * boneWeights.x;
worldNormal += normalMatrix * inNormal * boneWeights.x;
if(bUseDot3)
{
worldTangent += normalMatrix * inTangent * boneWeights.x;
worldBiNormal += normalMatrix * inBiNormal * boneWeights.x;
}
}
}
gl_Position = ViewProjMatrix * position;
// lighting
mediump vec3 TmpLightDir = normalize(LightPos - position.xyz);
if(bUseDot3)
{
Light.x = dot(normalize(worldTangent), TmpLightDir);
Light.y = dot(normalize(worldBiNormal), TmpLightDir);
Light.z = dot(normalize(worldNormal), TmpLightDir);
}
else
{
Light.x = dot(normalize(worldNormal), TmpLightDir);
}
}
// Pass through texcoords
TexCoord = inTexCoord;
}
\ No newline at end of file
:Title:
HelloAPI
:ShortDescription:
Draw a triangle to the screen using hardware acceleration.
:FullDescription:
A basic tutorial that guides the user, step-by-step, through the process of initializing a window using :API:, drawing a triangle in it using hardware acceleration, and then terminating the window.
Controls:
- Esc - Close the application
:VGP:
Not Required
:Polygon Count:
1
:Vertex Count:
3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>IMG.icns</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.imgtec.$\{PRODUCT_NAME:rfc1034identifier\}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) Imagination Technologies Ltd. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
//
// Prefix header for all source files of the 'OGLES2HelloAPI' target in the 'OGLES2HelloAPI' project
//
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Content Files">
<UniqueIdentifier>{900022e4-757a-46fb-bd53-6dfc20b3d893}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\..\..\..\Builds\Windows\Resources\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\..\..\..\..\Builds\Windows\Resources\shared.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\OGLES2HelloAPI_Windows.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>IMG.icns</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.imgtec.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (c) Imagination Technologies Ltd. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
: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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Content Files">
<UniqueIdentifier>{900022e4-757a-46fb-bd53-6dfc20b3d893}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\..\..\..\Shell\PVRShell.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\..\..\Shell\PVRShellImpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\..\..\Shell\API\KEGL\PVRShellAPI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\..\..\Shell\OS\Windows\PVRShellOS.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\..\..\Builds\Windows\Resources\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\..\..\..\..\Builds\Windows\Resources\shared.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\OGLESBasicTnL.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\..\Shell\PVRShell.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\..\Shell\API\KEGL\PVRShellAPI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\..\Shell\OS\Windows\PVRShellOS.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)out\$(Configuration)_$(Platform)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
\ No newline at end of file
/******************************************************************************
@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)
******************************************************************************/
:Title:
ColourGrading
:ShortDescription:
This example demonstrates using 3D textures to perform colour grading.
:FullDescription:
Colour grading is the act of enhancing the colour of a scene. This example demonstrates colour grading using a 3D texture as a look up table in a post process stage of the render.
#version 300 es
uniform sampler2D sTexture;
in mediump vec2 texCoords;
layout(location = 0) out lowp vec4 oFragColour;
void main()
{
highp vec3 vCol = texture(sTexture, texCoords).rgb;
oFragColour = vec4(vCol, 1.0);
}

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OGLES3ColourGrading", "OGLES3ColourGrading.vcxproj", "{9DAFEE32-19F6-4410-AA09-2B564FB86F62}"
ProjectSection(ProjectDependencies) = postProject
{09ABE661-9BC0-4152-A820-1FB0522CAC01} = {09ABE661-9BC0-4152-A820-1FB0522CAC01}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OGLES3Tools", "..\..\..\..\..\..\Tools\OGLES3\Build\WindowsVC2010\OGLES3Tools.vcxproj", "{09ABE661-9BC0-4152-A820-1FB0522CAC01}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9DAFEE32-19F6-4410-AA09-2B564FB86F62}.Debug|Win32.ActiveCfg = Debug|Win32
{9DAFEE32-19F6-4410-AA09-2B564FB86F62}.Debug|Win32.Build.0 = Debug|Win32
{9DAFEE32-19F6-4410-AA09-2B564FB86F62}.Debug|x64.ActiveCfg = Debug|x64
{9DAFEE32-19F6-4410-AA09-2B564FB86F62}.Debug|x64.Build.0 = Debug|x64
{9DAFEE32-19F6-4410-AA09-2B564FB86F62}.Release|Win32.ActiveCfg = Release|Win32
{9DAFEE32-19F6-4410-AA09-2B564FB86F62}.Release|Win32.Build.0 = Release|Win32
{9DAFEE32-19F6-4410-AA09-2B564FB86F62}.Release|x64.ActiveCfg = Release|x64
{9DAFEE32-19F6-4410-AA09-2B564FB86F62}.Release|x64.Build.0 = Release|x64
{09ABE661-9BC0-4152-A820-1FB0522CAC01}.Debug|Win32.ActiveCfg = Debug|Win32
{09ABE661-9BC0-4152-A820-1FB0522CAC01}.Debug|Win32.Build.0 = Debug|Win32
{09ABE661-9BC0-4152-A820-1FB0522CAC01}.Debug|x64.ActiveCfg = Debug|x64
{09ABE661-9BC0-4152-A820-1FB0522CAC01}.Debug|x64.Build.0 = Debug|x64
{09ABE661-9BC0-4152-A820-1FB0522CAC01}.Release|Win32.ActiveCfg = Release|Win32
{09ABE661-9BC0-4152-A820-1FB0522CAC01}.Release|Win32.Build.0 = Release|Win32
{09ABE661-9BC0-4152-A820-1FB0522CAC01}.Release|x64.ActiveCfg = Release|x64
{09ABE661-9BC0-4152-A820-1FB0522CAC01}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment