本文整理汇总了C++中PVRShellGet函数的典型用法代码示例。如果您正苦于以下问题:C++ PVRShellGet函数的具体用法?C++ PVRShellGet怎么用?C++ PVRShellGet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PVRShellGet函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: LoadVBOs
// ---------------------------------------------------------------
bool MyPVRDemo::InitView()
{
CPVRTString ErrorStr;
LoadVBOs();
bool bResult = true;
bResult &= LoadTextures(&ErrorStr);
bResult &= LoadShaders(&ErrorStr);
bResult &= CreateFBOs(&ErrorStr);
if(!bResult)
{
PVRShellSet(prefExitMessage, ErrorStr.c_str());
return false;
}
m_bRotated = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen);
// --- Set up light position, projection and view
m_vLightPos = PVRTVec3(0, 125, 200);
m_mxLightProj = PVRTMat4::PerspectiveFovRH(PVRT_PI / 4, 1.0f, 10.0f, 1000.0f, PVRTMat4::OGL, m_bRotated);
m_mxLightView = PVRTMat4::LookAtRH(m_vLightPos, PVRTVec3(0,25,0), PVRTVec3(0,1,0));
m_mxLightBias = PVRTMat4(0.5f, 0.0f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f, 0.0f,
0.0f, 0.0f, 0.5f, 0.0f,
0.5f, 0.5f, 0.5f, 1.0f);
// --- Set up Camera projection and view
float fAspect = PVRShellGet(prefWidth) / (float)PVRShellGet(prefHeight);
m_mxProjection = PVRTMat4::PerspectiveFovFloatDepthRH(0.75f, fAspect, 10.0f, PVRTMat4::OGL, m_bRotated);
m_mxCam = PVRTMat4::LookAtRH(PVRTVec3(0, 55, 150), PVRTVec3(0, 35, 0), PVRTVec3(0, 1, 0));
// --- Set GL states
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_GEQUAL);
glClearDepthf(0.0f);
glClearColor(0,0,0,1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
return true;
}
开发者ID:arron-h,项目名称:hebe-pvr-demo,代码行数:44,代码来源:MyPVRDemo.cpp
示例2: PVRShellGet
/*******************************************************************************
* Function Name : InitApplication
* Inputs : argc, *argv[], uWidth, uHeight
* Returns : true if no error occured
* Description : Code in InitApplication() will be called by the Shell ONCE per
* run, early on in the execution of the program.
* Used to initialize variables that are not dependant on the
* rendering context (e.g. external modules, loading meshes, etc.)
*******************************************************************************/
bool OGLESPolybump::InitApplication()
{
// Get and set the read path for content files
CPVRTResourceFile::SetReadPath((char*)PVRShellGet(prefReadPath));
// Get and set the load/release functions for loading external files.
// In the majority of cases the PVRShell will return NULL function pointers implying that
// nothing special is required to load external files.
CPVRTResourceFile::SetLoadReleaseFunctions(PVRShellGet(prefLoadFileFunc), PVRShellGet(prefReleaseFileFunc));
// Load the scene
if(m_Scene.ReadFromFile(c_szSceneFile) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, "ERROR: Couldn't load the .pod file\n");
return false;
}
return true;
}
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:28,代码来源:OGLESPolyBump.cpp
示例3: glBindFramebuffer
// ---------------------------------------------------------------
void MyPVRDemo::RenderShadowScene()
{
// --- Bind the shadow map FBO
glBindFramebuffer(GL_FRAMEBUFFER, m_uiShadowMapFBO);
glViewport(0, 0, SHADOW_MAP_SIZE, SHADOW_MAP_SIZE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Turn off colour writing
glUseProgram(m_SimpleShader.uiID);
// Create MVP using the light's matrix properties
PVRTMat4 mxMVP = m_mxLightProj * m_mxLightView * PVRTMat4::Identity();
glUniformMatrix4fv(m_SimpleShader.uiMVP, 1, GL_FALSE, mxMVP.ptr());
DrawMesh(enumMODEL_Statue, FLAG_VRT);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); // We can turn colour writing back on.
glBindFramebuffer(GL_FRAMEBUFFER, m_nOrigFBO); // Done. Use the original framebuffer.
glViewport(0, 0, PVRShellGet(prefWidth), PVRShellGet(prefHeight));
}
开发者ID:arron-h,项目名称:hebe-pvr-demo,代码行数:21,代码来源:MyPVRDemo.cpp
示例4: InitApplication
/*!****************************************************************************
@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 OGLESIntroducingPVRTools::InitApplication()
{
/*
CPVRTResourceFile is a resource file helper class. Resource files can
be placed on disk next to the executable or in a platform dependent
read path. We need to tell the class where that read path is.
Additionally, it is possible to wrap files into cpp modules and
link them directly into the executable. In this case no path will be
used. Files on disk will override "memory files".
*/
// Get and set the read path for content files
CPVRTResourceFile::SetReadPath((char*)PVRShellGet(prefReadPath));
// Get and set the load/release functions for loading external files.
// In the majority of cases the PVRShell will return NULL function pointers implying that
// nothing special is required to load external files.
CPVRTResourceFile::SetLoadReleaseFunctions(PVRShellGet(prefLoadFileFunc), PVRShellGet(prefReleaseFileFunc));
return true;
}
开发者ID:anonymousjustice,项目名称:pvr-pi,代码行数:30,代码来源:OGLES2IntroducingPVRTools.cpp
示例5: InitView
/*!****************************************************************************
@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 dependent on the rendering
context (e.g. textures, vertex buffers, etc.)
******************************************************************************/
bool OGLES2ProceduralTextures::InitView()
{
CPVRTString ErrorStr;
bool bRotate = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen);
if (!LoadShaders(&ErrorStr))
{
PVRShellSet(prefExitMessage, ErrorStr.c_str());
return false;
}
// Initialize Print3D textures
if (m_Print3D.SetTextures(NULL, PVRShellGet(prefWidth), PVRShellGet(prefHeight), bRotate) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, "Error: Cannot initialise Print3D.\n");
return false;
}
if (!m_pProceduralTextures->Init(&ErrorStr))
{
PVRShellSet(prefExitMessage, ErrorStr.c_str());
return false;
}
if (!GenerateFnTexture())
{
PVRShellSet(prefExitMessage, "Error: Failed to generate texture.\n");
return false;
}
glGenTextures(1, &m_ui32ColourSplineTexture);
glBindTexture(GL_TEXTURE_2D, m_ui32ColourSplineTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0, GL_RGB, GL_UNSIGNED_BYTE, c_pszColourSplineData);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glBindTexture(GL_TEXTURE_2D, 0);
return true;
}
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:49,代码来源:OGLES3ProceduralTextures.cpp
示例6: InitApplication
/*!****************************************************************************
@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 OGLESIntroducingPFX::InitApplication()
{
// Get and set the read path for content files
CPVRTResourceFile::SetReadPath((char*)PVRShellGet(prefReadPath));
// Get and set the load/release functions for loading external files.
// In the majority of cases the PVRShell will return NULL function pointers implying that
// nothing special is required to load external files.
CPVRTResourceFile::SetLoadReleaseFunctions(PVRShellGet(prefLoadFileFunc), PVRShellGet(prefReleaseFileFunc));
// Load the scene
if (m_Scene.ReadFromFile(c_szSceneFile) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, "ERROR: Couldn't load the .pod file\n");
return false;
}
// The cameras are stored in the file. We check it contains at least one.
if(m_Scene.nNumCamera == 0)
{
PVRShellSet(prefExitMessage, "ERROR: The scene does not contain a camera\n");
return false;
}
// Ensure that all meshes use an indexed triangle list
for(unsigned int i = 0; i < m_Scene.nNumMesh; ++i)
{
if(m_Scene.pMesh[i].nNumStrips || !m_Scene.pMesh[i].sFaces.pData)
{
PVRShellSet(prefExitMessage, "ERROR: The meshes in the scene should use an indexed triangle list\n");
return false;
}
}
// Initialize variables used for the animation
m_fFrame = 0;
m_iTimePrev = PVRShellGetTime();
return true;
}
开发者ID:anonymousjustice,项目名称:pvr-pi,代码行数:50,代码来源:OGLES2IntroducingPFX.cpp
示例7: InitView
/*!****************************************************************************
@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 OGLES2Coverflow::InitView()
{
CPVRTString ErrorStr;
// Get and set the read path for content files
CPVRTResourceFile::SetReadPath((char*)PVRShellGet(prefReadPath));
// Get and set the load/release functions for loading external files.
// In the majority of cases the PVRShell will return NULL function pointers implying that
// nothing special is required to load external files.
CPVRTResourceFile::SetLoadReleaseFunctions(PVRShellGet(prefLoadFileFunc), PVRShellGet(prefReleaseFileFunc));
if (!LoadTextures(&ErrorStr))
{
PVRShellSet(prefExitMessage, ErrorStr.c_str());
return false;
}
if (!LoadShaders(&ErrorStr))
{
PVRShellSet(prefExitMessage, ErrorStr.c_str());
return false;
}
bool bRotate = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen);
if(m_Print3D.SetTextures(0,PVRShellGet(prefWidth),PVRShellGet(prefHeight), bRotate) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, "ERROR: Cannot initialise Print3D\n");
return false;
}
PVRTVECTOR3 vFrom = {0.0f, 0.0f, 15.0f },
vTo = { 0, 0, 0 },
vUp = { 0, 1, 0 };
PVRTMatrixPerspectiveFovRH(m_mProjection, g_FOV, f2vt((float)PVRShellGet(prefWidth)/(float)PVRShellGet(prefHeight)), f2vt(g_fCameraNear), f2vt(g_fCameraFar), bRotate);
PVRTMatrixLookAtRH(m_mView, vFrom, vTo, vUp);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
//this must be called after InitApplication
CreateCover();
// Enable culling
glEnable(GL_CULL_FACE);
return true;
}
开发者ID:JLIGames,项目名称:GameThirdPartyLibs,代码行数:57,代码来源:OGLES2Coverflow.cpp
示例8: InitApplication
/*!****************************************************************************
@Function InitApplication
@Return bool true if no error occurred
@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 OGLES2Glass::InitApplication()
{
m_puiVbo = 0;
m_puiIndexVbo = 0;
m_puiBalloonVbo = 0;
m_puiBalloonIndexVbo = 0;
// Get and set the read path for content files
CPVRTResourceFile::SetReadPath((char*)PVRShellGet(prefReadPath));
// Get and set the load/release functions for loading external files.
// In the majority of cases the PVRShell will return NULL function pointers implying that
// nothing special is required to load external files.
CPVRTResourceFile::SetLoadReleaseFunctions(PVRShellGet(prefLoadFileFunc), PVRShellGet(prefReleaseFileFunc));
// Load the mask
if (m_Ball.ReadFromFile(c_szBallFile) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, "ERROR: Couldn't load the .pod file\n");
return false;
}
// Load the balloon
if (m_Balloon.ReadFromFile(c_szBalloonFile) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, "ERROR: Couldn't load the .pod file\n");
return false;
}
m_ulTime = ULONG_MAX;
m_afAngles[0] = 0.0f;
m_afAngles[1] = 0.0f;
m_iEffect = 0;
return true;
}
开发者ID:deepbansal15,项目名称:Native_SDK,代码行数:48,代码来源:OGLES2Glass.cpp
示例9: InitApplication
// ---------------------------------------------------------------
bool MyPVRDemo::InitApplication()
{
#ifdef PLATFORM_IOS
CPVRTResourceFile::SetReadPath((char*)PVRShellGet(prefReadPath));
#endif
if (m_Model.ReadFromFile(c_szSceneFile) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, "ERROR: Couldn't load the .pod file\n");
return false;
}
assert(enumMODEL_MAX == m_Model.nNumMesh);
// Calculate a bounding box around the statue that we can use later on
SPODMesh* pMesh = &m_Model.pMesh[m_Model.pNode[enumMODEL_Statue].nIdx];
PVRTBOUNDINGBOX bb;
PVRTBoundingBoxComputeInterleaved(&bb, pMesh->pInterleaved, pMesh->nNumVertex, 0, pMesh->sVertex.nStride);
// We need to calculate the longest possible length for our bounding box on the X and Z axis (as we're rotating around Y).
float fLen[4];
fLen[0] = sqrt(bb.Point[7].x * bb.Point[7].x + bb.Point[7].z * bb.Point[7].z); // FR quadrant
fLen[1] = sqrt(bb.Point[3].x * bb.Point[3].x + bb.Point[3].z * bb.Point[3].z); // FL quadrant
fLen[2] = sqrt(bb.Point[6].x * bb.Point[6].x + bb.Point[6].z * bb.Point[6].z); // BR quadrant
fLen[3] = sqrt(bb.Point[2].x * bb.Point[2].x + bb.Point[2].z * bb.Point[2].z); // BL quadrant
float fLongest = max(fLen[0], fLen[1]);
fLongest = max(fLongest, fLen[2]);
fLongest = max(fLongest, fLen[3]);
// Calculate the top left and bottom right of the bounding box in 2D space
m_bbStatueTL = PVRTVec4(-fLongest, bb.Point[3].y, bb.Point[3].z, 1.0f);
m_bbStatueBR = PVRTVec4( fLongest, bb.Point[5].y, bb.Point[5].z, 1.0f);
// Some nice variables
m_fAngleY = 0.0f;
m_fBloomMulti = 0.3f;
m_ulCurrTime = 0;
m_fLightAngle = PVRT_PI / 8; // Offset by 22.5degrees to begin with, so we see the shadow slightly offset from behind the model.
m_fTexelOffset = 1.0f / RTT_SIZE;
float w1 = 0.0555555f;
float w2 = 0.2777777f;
float intraTexelOffset = (w2 / (w1 + w2)) * m_fTexelOffset; // Weight between 2 texels so that hardware filtering will
// interpolate the texels for us. Effectively reducing a 5x5 kernel
// to a 3x3.
m_fTexelOffset += intraTexelOffset;
return true;
}
开发者ID:arron-h,项目名称:hebe-pvr-demo,代码行数:51,代码来源:MyPVRDemo.cpp
示例10: InitApplication
/*!****************************************************************************
@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 OGLES2LightMap::InitApplication()
{
// Get and set the read path for content files
CPVRTResourceFile::SetReadPath((char*)PVRShellGet(prefReadPath));
// Get and set the load/release functions for loading external files.
// In the majority of cases the PVRShell will return NULL function pointers implying that
// nothing special is required to load external files.
CPVRTResourceFile::SetLoadReleaseFunctions(PVRShellGet(prefLoadFileFunc), PVRShellGet(prefReleaseFileFunc));
// Load the scene files
if(!m_Models[0].ReadFromFile(c_szMaskFile) ||
!m_Models[1].ReadFromFile(c_szPlaneFile))
{
PVRShellSet(prefExitMessage, "ERROR: Couldn't load the .pod file\n");
return false;
}
m_fAngleX = 0.0f;
m_fAngleY = 0.0f;
return true;
}
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:33,代码来源:OGLES2LightMap.cpp
示例11: InitApplication
/*!****************************************************************************
@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 OGLES2StencilBuffer::InitApplication()
{
// Get and set the read path for content files
CPVRTResourceFile::SetReadPath((char*)PVRShellGet(prefReadPath));
// Load the scene files
if(!m_Cylinder.ReadFromFile(c_szCylinderFile) ||
!m_Sphere.ReadFromFile(c_szSphereFile))
{
PVRShellSet(prefExitMessage, "ERROR: Couldn't load the .pod file\n");
return false;
}
// Initialise the angle variable
m_fAngle = 0.0f;
// Request Stencil Buffer support
PVRShellSet(prefStencilBufferContext, true);
return true;
}
开发者ID:zhurb88,项目名称:PVR-OGLES2.0,代码行数:30,代码来源:OGLES2StencilBuffer.cpp
示例12: PVRShellSet
/*******************************************************************************
* Function Name : InitView
* Returns : true if no error occured
* Description : Code in InitView() will be called by the Shell upon a change
* in the rendering context.
* Used to initialize variables that are dependant on the rendering
* context (e.g. textures, vertex buffers, etc.)
*******************************************************************************/
bool OGLESSkinning::InitView()
{
CPVRTString error;
// Check to see whether the matrix palette extension is supported.
if(!CPVRTglesExt::IsGLExtensionSupported("GL_OES_matrix_palette"))
{
PVRShellSet(prefExitMessage, "ERROR: The extension GL_OES_matrix_palette is unsupported.\n");
return false;
}
// Initialise the matrix palette extensions
m_Extensions.LoadExtensions();
// Load the textures
if(!LoadTextures(&error))
{
PVRShellSet(prefExitMessage, error.c_str());
return false;
}
// Init Print3D to display text on screen
bool bRotate = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen);
if(m_Print3D.SetTextures(0, PVRShellGet(prefWidth),PVRShellGet(prefHeight), bRotate) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, "ERROR: Cannot initialise Print3D\n");
return false;
}
// Model View Matrix
CameraGetMatrix();
// Projection Matrix
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(m_mProjection.f);
// GENERIC RENDER STATES
// Enables Depth Testing
glEnable(GL_DEPTH_TEST);
// Enables Smooth Colour Shading
glShadeModel(GL_SMOOTH);
// Enable texturing
glEnable(GL_TEXTURE_2D);
// Define front faces
glFrontFace(GL_CW);
// Enables texture clamping
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
// Reset the model view matrix to position the light
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// Setup ambiant light
glEnable(GL_LIGHTING);
PVRTVec4 lightGlobalAmbient = PVRTVec4(1.0f, 1.0f, 1.0f, 1.0f);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lightGlobalAmbient.ptr());
// Setup a directional light source
PVRTVec4 lightPosition = PVRTVec4(-0.7f, -1.0f, 0.2f, 0.0f);
PVRTVec4 lightAmbient = PVRTVec4(1.0f, 1.0f, 1.0f, 1.0f);
PVRTVec4 lightDiffuse = PVRTVec4(1.0f, 1.0f, 1.0f, 1.0f);
PVRTVec4 lightSpecular = PVRTVec4(0.2f, 0.2f, 0.2f, 1.0f);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition.ptr());
glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmbient.ptr());
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDiffuse.ptr());
glLightfv(GL_LIGHT0, GL_SPECULAR, lightSpecular.ptr());
LoadVbos();
/*
Initialise an array to lookup the textures
for each material in the scene.
*/
m_puiTextures = new GLuint[m_Scene.nNumMaterial];
for(unsigned int i = 0; i < m_Scene.nNumMaterial; ++i)
{
m_puiTextures[i] = m_uiLegTex;
SPODMaterial* pMaterial = &m_Scene.pMaterial[i];
if(strcmp(pMaterial->pszName, "Mat_body") == 0)
{
//.........这里部分代码省略.........
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:101,代码来源:OGLESSkinning.cpp
示例13: InitView
/*!****************************************************************************
@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 OGLES3Refraction::InitView()
{
CPVRTString ErrorStr;
/*
Initialize VBO data
*/
LoadVbos();
/*
Load textures
*/
if (!LoadTextures(&ErrorStr))
{
PVRShellSet(prefExitMessage, ErrorStr.c_str());
return false;
}
/*
Load and compile the shaders & link programs
*/
if (!LoadShaders(&ErrorStr))
{
PVRShellSet(prefExitMessage, ErrorStr.c_str());
return false;
}
// Set the sampler2D uniforms to corresponding texture units
glUniform1i(glGetUniformLocation(m_ShaderProgram.uiId, "sTexture"), 0);
// Is the screen rotated?
m_bRotate = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen);
/*
Initialize Print3D
*/
if(m_Print3D.SetTextures(0,PVRShellGet(prefWidth),PVRShellGet(prefHeight), m_bRotate) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, "ERROR: Cannot initialise Print3D\n");
return false;
}
/*
Initalise the background
*/
if(m_Background.Init(0, m_bRotate, &ErrorStr) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, ErrorStr.c_str());
return false;
}
/*
Calculate the projection and view matrices
*/
m_mProjection = PVRTMat4::PerspectiveFovRH(PVRT_PI/6, (float)PVRShellGet(prefWidth)/(float)PVRShellGet(prefHeight), CAM_NEAR, CAM_FAR, PVRTMat4::OGL, m_bRotate);
m_mView = PVRTMat4::LookAtRH(PVRTVec3(0, 0, 150), PVRTVec3(0, 0, 0), PVRTVec3(0, 1, 0));
/*
Set OpenGL ES render states needed for this training course
*/
// Use a nice bright blue as clear colour
glClearColor(0.6f, 0.8f, 1.0f, 1.0f);
return true;
}
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:75,代码来源:OGLES3Refraction.cpp
示例14: InitView
/*!****************************************************************************
@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 OGLES2AnisotropicLighting::InitView()
{
CPVRTString ErrorStr;
/*
Initialize VBO data
*/
LoadVbos();
/*
Load textures
*/
if (!LoadTextures(&ErrorStr))
{
PVRShellSet(prefExitMessage, ErrorStr.c_str());
return false;
}
/*
Load and compile the shaders & link programs
*/
if (!LoadShaders(&ErrorStr))
{
PVRShellSet(prefExitMessage, ErrorStr.c_str());
return false;
}
// Is the screen rotated?
bool bRotate = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen);
/*
Initialize Print3D
*/
if(m_Print3D.SetTextures(0,PVRShellGet(prefWidth),PVRShellGet(prefHeight), bRotate) != PVR_SUCCESS)
{
PVRShellSet(prefExitMessage, "ERROR: Cannot initialise Print3D\n");
return false;
}
/*
Calculate the projection and view matrices
*/
float fAspect = PVRShellGet(prefWidth) / (float)PVRShellGet(prefHeight);
m_mViewProj = PVRTMat4::PerspectiveFovFloatDepthRH(CAM_FOV, fAspect, CAM_NEAR, PVRTMat4::OGL, bRotate);
m_mViewProj *= PVRTMat4::LookAtRH(PVRTVec3(0.f, 0.f, 150.f), PVRTVec3(0.f), PVRTVec3(0.f, 1.f, 0.f));
/*
Set uniforms that are constant throughout this training course
*/
// Set the sampler2D variable to the first texture unit
glUseProgram(m_FastShader.uiId);
glUniform1i(glGetUniformLocation(m_FastShader.uiId, "sTexture"), 0);
// Define material properties
glUseProgram(m_SlowShader.uiId);
float afMaterial[4] = {
0.4f, // Diffuse intensity scale
0.6f, // Diffuse intensity bias
0.82f, // Specular intensity scale
0.0f, // Specular bias
};
glUniform4fv(glGetUniformLocation(m_SlowShader.uiId, "Material"), 1, afMaterial);
// Set surface grain direction
PVRTVec3 vMsGrainDir = PVRTVec3(2, 1, 0).normalized();
glUniform3fv(glGetUniformLocation(m_SlowShader.uiId, "GrainDir"), 1, vMsGrainDir.ptr());
/*
Set OpenGL ES render states needed for this training course
*/
// Enable backface culling and depth test
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
// Enable z-buffer test
// We are using a projection matrix optimized for a floating point depth buffer,
// so the depth test and clear value need to be inverted (1 becomes near, 0 becomes far).
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_GEQUAL);
glClearDepthf(0.0f);
// Use a nice bright blue as clear colour
glClearColor(0.6f, 0.8f, 1.0f, 1.0f);
m_fAngleY = 0;
m_eRenderMode = eTexLookup;
return true;
}
开发者ID:anonymousjustice,项目名称:pvr-pi,代码行数:95,代码来源:OGLES2AnisotropicLighting.cpp
注:本文中的PVRShellGet函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论