当前位置: 首页>>代码示例>>C++>>正文


C++ PVRShellSet函数代码示例

本文整理汇总了C++中PVRShellSet函数的典型用法代码示例。如果您正苦于以下问题:C++ PVRShellSet函数的具体用法?C++ PVRShellSet怎么用?C++ PVRShellSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PVRShellSet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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 dependent on it
				(e.g. external modules, loading meshes, etc.)
				If the rendering context is lost, InitApplication() will
				not be called again.
******************************************************************************/
bool OGLES2ParallaxBumpMap::InitApplication()
{
	m_puiVbo = 0;
	m_puiIndexVbo = 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 scene
	if (m_Scene.ReadFromFile(c_szSceneFile) != PVR_SUCCESS)
	{
		PVRShellSet(prefExitMessage, "ERROR: Couldn't load the .pod file\n");
		return false;
	}

	m_fAngleY = 0.0f;

	return true;
}
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:34,代码来源:OGLES2ParallaxBumpMap.cpp

示例2: InitView

/*!****************************************************************************
 @Function		InitView
 @Return		bool		true if no error occurred
 @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 OGLES2Glass::InitView()
{
	CPVRTString ErrorStr;
	// Store the original FBO handle
	glGetIntegerv(GL_FRAMEBUFFER_BINDING, &m_iOriginalFramebuffer);
	/*
		Initialize VBO data
	*/
	LoadVbos();

	if (!LoadParaboloids(&ErrorStr))
	{
		PVRShellSet(prefExitMessage, ErrorStr.c_str());
		return false;
	}

	/*
		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;
	}

	// Set the sampler2D uniforms to corresponding texture units
	glUseProgram(m_DefaultProgram.uiId);
	glUniform1i(glGetUniformLocation(m_DefaultProgram.uiId, "s2DMap"), 0);
	
	glUseProgram(m_SkyboxProgram.uiId);
	glUniform1i(glGetUniformLocation(m_SkyboxProgram.uiId, "sSkybox"), 0);

	glUseProgram(m_ParaboloidProgram.uiId);
	glUniform1i(glGetUniformLocation(m_ParaboloidProgram.uiId, "s2DMap"), 0);
	glUniform1f(glGetUniformLocation(m_ParaboloidProgram.uiId, "Near"), g_fCamNear);
	glUniform1f(glGetUniformLocation(m_ParaboloidProgram.uiId, "Far"), g_fCamFar);

	for (int i = 0; i < g_iNumEffects; ++i) {
		glUseProgram(m_aEffectPrograms[i].uiId);
		glUniform1i(glGetUniformLocation(m_aEffectPrograms[i].uiId, "sParaboloids"), 0);
		glUniform1i(glGetUniformLocation(m_aEffectPrograms[i].uiId, "sSkybox"), 1);
	}

	

	/*
		Calculate the projection and view matrices
	*/
	m_mProjection = PVRTMat4::PerspectiveFovRH(g_fCamFOV, (float)PVRShellGet(prefWidth)/(float)PVRShellGet(prefHeight), g_fCamNear, g_fCamFar, PVRTMat4::OGL, bRotate);

	/*
		Set OpenGL ES render states needed for this training course
	*/
	// Enable backface culling and depth test
	glCullFace(GL_BACK);
	glEnable(GL_CULL_FACE);

	glEnable(GL_DEPTH_TEST);

	// Use a nice bright blue as clear colour
	glClearColor(0.6f, 0.8f, 1.0f, 0.0f);

	return true;
}
开发者ID:deepbansal15,项目名称:Native_SDK,代码行数:92,代码来源:OGLES2Glass.cpp

示例3: 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

示例4: PVRShellSet

/*!****************************************************************************
 @Function		LoadShaders
 @Output		pErrorStr		A string describing the error on failure
 @Return		bool			true if no error occured
 @Description	Loads and compiles the shaders and links the shader programs
				required for this training course
******************************************************************************/
bool OGLES2AnisotropicLighting::LoadShaders(CPVRTString* pErrorStr)
{
	/*
		Load and compile the shaders from files.
		Binary shaders are tried first, source shaders
		are used as fallback.
	*/
	if (PVRTShaderLoadFromFile(c_szFastVsBinFile,
			                   c_szFastVsSrcFile,
							   GL_VERTEX_SHADER,
							   GL_SGX_BINARY_IMG,
							   &m_uiFastVertShader,
							   pErrorStr) != PVR_SUCCESS)
	{
		*pErrorStr = CPVRTString("From file '") + c_szFastVsBinFile +
					 "' or '" + c_szFastVsSrcFile + "':\n" + *pErrorStr;
		PVRShellSet(prefExitMessage, pErrorStr->c_str());
		return false;
	}

	if (PVRTShaderLoadFromFile(c_szFastFsBinFile,
							   c_szFastFsSrcFile,
							   GL_FRAGMENT_SHADER,
							   GL_SGX_BINARY_IMG,
							   &m_uiFastFragShader,
							   pErrorStr) != PVR_SUCCESS)
	{
		*pErrorStr = CPVRTString("From file '") + c_szFastVsBinFile +
					 "' or '" + c_szFastVsSrcFile + "':\n" + *pErrorStr;
		PVRShellSet(prefExitMessage, pErrorStr->c_str());
		return false;
	}

	if (PVRTShaderLoadFromFile(c_szSlowVsBinFile,
							   c_szSlowVsSrcFile,
							   GL_VERTEX_SHADER,
							   GL_SGX_BINARY_IMG,
							   &m_uiSlowVertShader,
							   pErrorStr) != PVR_SUCCESS)
	{
		*pErrorStr = CPVRTString("From file '") + c_szFastVsBinFile +
					 "' or '" + c_szFastVsSrcFile + "':\n" + *pErrorStr;
		PVRShellSet(prefExitMessage, pErrorStr->c_str());
		return false;
	}

	if (PVRTShaderLoadFromFile(c_szSlowFsBinFile,
							   c_szSlowFsSrcFile,
							   GL_FRAGMENT_SHADER,
							   GL_SGX_BINARY_IMG,
							   &m_uiSlowFragShader,
							   pErrorStr) != PVR_SUCCESS)
	{
		*pErrorStr = CPVRTString("From file '") + c_szFastVsBinFile +
					 "' or '" + c_szFastVsSrcFile + "':\n" + *pErrorStr;
		PVRShellSet(prefExitMessage, pErrorStr->c_str());
		return false;
	}

	/*
		Set up and link the shader programs
	*/
	const char* aszAttribs[] = { "inVertex", "inNormal"	};
	if	(
		(PVRTCreateProgram(&m_FastShader.uiId, m_uiFastVertShader, m_uiFastFragShader, aszAttribs, 2, pErrorStr) != PVR_SUCCESS) ||
		(PVRTCreateProgram(&m_SlowShader.uiId, m_uiSlowVertShader, m_uiSlowFragShader, aszAttribs, 2, pErrorStr) != PVR_SUCCESS)
		)
	{
		PVRShellSet(prefExitMessage, pErrorStr->c_str());
		return false;
	}

	/*
		Store the location of uniforms for later use
	*/
	m_FastShader.uiMVPMatrixLoc		= glGetUniformLocation(m_FastShader.uiId, "MVPMatrix");
	m_FastShader.uiMsLightDirLoc	= glGetUniformLocation(m_FastShader.uiId, "msLightDir");
	m_FastShader.uiMsEyePosLoc		= glGetUniformLocation(m_FastShader.uiId, "msEyePos");

	m_SlowShader.uiMVPMatrixLoc		= glGetUniformLocation(m_SlowShader.uiId, "MVPMatrix");
	m_SlowShader.uiMsLightDirLoc	= glGetUniformLocation(m_SlowShader.uiId, "msLightDir");
	m_SlowShader.uiMsEyeDirLoc		= glGetUniformLocation(m_SlowShader.uiId, "msEyeDir");

	return true;
}
开发者ID:anonymousjustice,项目名称:pvr-pi,代码行数:92,代码来源:OGLES2AnisotropicLighting.cpp

示例5: 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 dependent on it
				(e.g. external modules, loading meshes, etc.)
				If the rendering context is lost, InitApplication() will
				not be called again.
******************************************************************************/
bool OGLESPVRScopeRemote::InitApplication()
{
	// We want a data connection to PVRPerfServer
	{
		m_psSPSCommsData = pplInitialise("PVRScopeRemote", 14);
		m_bCommsError = false;

		// Demonstrate that there is a good chance of the initial data being
		// lost - the connection is normally completed asynchronously.
		pplSendMark(m_psSPSCommsData, "lost", static_cast<unsigned int>(strlen("lost")));

		// This is entirely optional. Wait for the connection to succeed, it will
		// timeout if e.g. PVRPerfServer is not running.
		int nBoolConnected;
		pplWaitForConnection(m_psSPSCommsData, &nBoolConnected, 1, 200);
	}

	CPPLProcessingScoped PPLProcessingScoped(m_psSPSCommsData,
		__FUNCTION__, static_cast<unsigned int>(strlen(__FUNCTION__)), m_i32FrameCounter);

	// set thickness variation of the film
	m_fMaxVariation		= 100.0f;
	// set the minimum thickness of the film
	m_fMinThickness		= 100.0f;

	m_i32FrameCounter = 0;
	m_i32Frame10Counter = 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));

	/*
		Loads the scene from the .pod file into a CPVRTModelPOD object.
		We could also export the scene as a header file and
		load it with ReadFromMemory().
	*/

	if(m_Scene.ReadFromFile(c_szSceneFile) != PVR_SUCCESS)
	{
		CPVRTString ErrorStr = "ERROR: Couldn't load '" + CPVRTString(c_szSceneFile) + "'.";
		PVRShellSet(prefExitMessage, ErrorStr.c_str());
		return false;
	}

	/*
		Remotely editable library items
	*/
	if(m_psSPSCommsData)
	{
		SSPSCommsLibraryItem	asItems[8];
		unsigned int			nItemCount = 0;

		// Want editable: min thickness
		m_sCommsLibMinThickness.fCurrent	= m_fMinThickness;
		m_sCommsLibMinThickness.fMin		= 0.0f;
		m_sCommsLibMinThickness.fMax		= 500.0f;
		asItems[nItemCount].pszName		= "min thickness";
		asItems[nItemCount].nNameLength	= (unsigned int)strlen(asItems[nItemCount].pszName);

		asItems[nItemCount].eType		= eSPSCommsLibTypeFloat;

		asItems[nItemCount].pData		= (const char*)&m_sCommsLibMinThickness;
		asItems[nItemCount].nDataLength	= sizeof(m_sCommsLibMinThickness);
		++nItemCount;

		// Want editable: max variation
		m_sCommsLibMaxVariation.fCurrent	= m_fMaxVariation;
		m_sCommsLibMaxVariation.fMin		= 50.0f;
		m_sCommsLibMaxVariation.fMax		= 150.0f;
		asItems[nItemCount].pszName		= "max variation";
		asItems[nItemCount].nNameLength	= (unsigned int)strlen(asItems[nItemCount].pszName);

		asItems[nItemCount].eType		= eSPSCommsLibTypeFloat;

		asItems[nItemCount].pData		= (const char*)&m_sCommsLibMaxVariation;
		asItems[nItemCount].nDataLength	= sizeof(m_sCommsLibMaxVariation);
		++nItemCount;

		_ASSERT(nItemCount < sizeof(asItems) / sizeof(*asItems));

		/*
			Ok, submit our library
		*/
		if(!pplLibraryCreate(m_psSPSCommsData, asItems, nItemCount))
		{
//.........这里部分代码省略.........
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:101,代码来源:OGLESPVRScopeRemote.cpp

示例6: PVRShellSet

/*!****************************************************************************
 @Function		LoadShaders
 @Output		pErrorStr		A string describing the error on failure
 @Return		bool			true if no error occured
 @Description	Loads and compiles the shaders and links the shader programs
				required for this training course
******************************************************************************/
bool OGLES3EdgeDetection::LoadShaders(CPVRTString* pErrorStr)
{
	/*	Load and compile the shaders from files.
		Binary shaders are tried first, source shaders
		are used as fallback. */

	// Load vertex shaders
	if (PVRTShaderLoadFromFile(
			c_szPreVertShaderBin, c_szPreVertShaderSrc, GL_VERTEX_SHADER, GL_SGX_BINARY_IMG, &m_uiPreVertShader, pErrorStr) != PVR_SUCCESS)
	{
		*pErrorStr += "Error: Could not load Pre Process Vertex Shader.";
		return false;
	}
	for (int i=0; i<eNumPostShaders; ++i)
	{
		if (PVRTShaderLoadFromFile(
				c_szPostVertShaderBin, c_szPostVertShaderSrc, GL_VERTEX_SHADER, GL_SGX_BINARY_IMG, &m_uiPostVertShaders[i],
				pErrorStr, 0, c_aszPostShaderDefines[i], g_auiNumPostShaderDefines[i]) != PVR_SUCCESS)
		{
			*pErrorStr += "Error: Could not load Post Process Vertex Shader: ";
			*pErrorStr += g_aszPostShaderNames[i];
			return false;
		}
	}

	// Load fragment shaders
	if (PVRTShaderLoadFromFile(
			c_szPreFragShaderBin, c_szPreFragShaderSrc, GL_FRAGMENT_SHADER, GL_SGX_BINARY_IMG, &m_uiPreFragShader, pErrorStr) != PVR_SUCCESS)
	{
		*pErrorStr += "Error: Could not load Pre Process Fragment Shader.";
		return false;
	}
	for (int i=0; i<eNumPostShaders; ++i)
	{
		if (PVRTShaderLoadFromFile(
				c_szPostFragShaderBin, c_szPostFragShaderSrc, GL_FRAGMENT_SHADER, GL_SGX_BINARY_IMG, &m_uiPostFragShaders[i],
				pErrorStr, 0, c_aszPostShaderDefines[i], g_auiNumPostShaderDefines[i]) != PVR_SUCCESS)
		{
			*pErrorStr += "Error: Could not load Post Process Vertex Shader: ";
			*pErrorStr += g_aszPostShaderNames[i];
			return false;
		}
	}

	// Set up and link the shader programs
	if (PVRTCreateProgram(&m_PreShader.uiId, m_uiPreVertShader, m_uiPreFragShader, g_aszAttribNames, eNumAttribs, pErrorStr) != PVR_SUCCESS)
	{
		*pErrorStr += "Failed to Link Pre Shader";
		PVRShellSet(prefExitMessage, pErrorStr->c_str());
		return false;
	}
	for (int i=0; i<eNumPostShaders; i++)
	{
		if (PVRTCreateProgram(&m_PostShaders[i].uiId, m_uiPostVertShaders[i], m_uiPostFragShaders[i], g_aszAttribNames, eNumAttribs, pErrorStr) != PVR_SUCCESS)
		{
			*pErrorStr += "Failed to Link Post Shader: ";
			*pErrorStr += g_aszPostShaderNames[i];
			PVRShellSet(prefExitMessage, pErrorStr->c_str());
			return false;
		}
	}

	// Store the location of uniforms for later use
	for (int i = 0; i < eNumPreUniforms; ++i)
	{
		m_PreShader.auiLoc[i] = glGetUniformLocation(m_PreShader.uiId, g_aszPreUniformNames[i]);
	}
	for (int i = 0; i < eNumPostShaders; i++)
	{
		for (int j = 0; j <eNumPostUniforms; j++)
		{
			m_PostShaders[i].auiLoc[j] = glGetUniformLocation(m_PostShaders[i].uiId, g_aszPostUniformNames[j]);
		}
		//Set the post shaders to use the render texture.
		glUseProgram(m_PostShaders[i].uiId);
		glUniform1i(m_PostShaders[i].auiLoc[eColorBufferTexture], 1);
	}

	return true;
}
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:87,代码来源:OGLES3EdgeDetection.cpp

示例7: InitView

/*!****************************************************************************
 @Function		InitView
 @Return		bool		true if no error occurred
 @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 OGLES3EdgeDetection::InitView()
{
	// Store width and height of the viewport.
	m_i32WinWidth = PVRShellGet(prefWidth);
	m_i32WinHeight = PVRShellGet(prefHeight);

	// Set our texture dimensions to be the same as our windows
	m_i32TexWidth = m_i32WinWidth;
	m_i32TexHeight = m_i32WinHeight;

	/*	Get the current frame buffer object. As the program hasn't set it yet, this is the default buffer.
		On most platforms this just gives 0, but there are exceptions.	*/
	glGetIntegerv(GL_FRAMEBUFFER_BINDING, &m_i32OriginalFramebuffer);

	// Create string for error codes.
	CPVRTString ErrorStr;

	// Checks to see if the screen is rotated or not.
    bool bRotate = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen);

	// Initialize VBO data
	if(!LoadVbos(&ErrorStr))
	{
		PVRShellSet(prefExitMessage, ErrorStr.c_str());
		return false;
	}

	// Initialise Print3D
	if(m_Print3D.SetTextures(0,m_i32WinWidth,m_i32WinHeight,bRotate) != PVR_SUCCESS)
	{
		PVRShellSet(prefExitMessage, "ERROR: Cannot initialise Print3D\n");
		return false;
	}

	// Load external textures and create internal ones.
	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;
	}

	// Creates and checks FBO creation
	if (!CreateFBO(&ErrorStr))
	{
		PVRShellSet(prefExitMessage, ErrorStr.c_str());
		return false;
	}

	SetupView(bRotate);

	//Initialises the time variables.
	m_ulCurrentTime = PVRShellGetTime();
	m_ulPreviousTimeAngle = m_ulCurrentTime;
	m_ulPreviousTimeFPS = m_ulCurrentTime;

	return true;
}
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:72,代码来源:OGLES3EdgeDetection.cpp

示例8: 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 OGLES2StencilBuffer::InitView()
{
	CPVRTString ErrorStr;

	/*
		Initialize VBO data
	*/
	m_Cylinder.LoadVbos();
	m_Sphere.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?
	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;
	}

	/*
		Set OpenGL ES render states needed for this training course
	*/
	// Enable backface culling and depth test
	glCullFace(GL_BACK);
	glEnable(GL_CULL_FACE);

	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);

	// Use a nice bright blue as clear colour
	glClearColor(0.6f, 0.8f, 1.0f, 1.0f);

	// Set stencil clear value
	glClearStencil(0);

	return true;
}
开发者ID:zhurb88,项目名称:PVR-OGLES2.0,代码行数:69,代码来源:OGLES2StencilBuffer.cpp

示例9: 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 OGLESRenderToTexture::InitView()
{
	CPVRTString ErrorStr;
	/*
		Initialise Print3D
	*/
    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;
	}

	// Enables texturing
	glEnable(GL_TEXTURE_2D);

	//	Initialize VBO data
	if(!LoadVbos(&ErrorStr))
	{
		PVRShellSet(prefExitMessage, ErrorStr.c_str());
		return false;
	}

	/*
		Load textures
	*/
	if(!LoadTextures(&ErrorStr))
	{
		PVRShellSet(prefExitMessage, ErrorStr.c_str());
		return false;
	}

	// Create a FBO or PBuffer
	if(!CreateFBOorPBuffer())
		return false;

	// Setup some render states

	// Enable the depth test
	glEnable(GL_DEPTH_TEST);

	// Enable culling
	glEnable(GL_CULL_FACE);

	// Setup the material parameters our meshes will use
	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT,  PVRTVec4(1.0f).ptr());
	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE,  PVRTVec4(1.0f).ptr());

	// Setup view and projection matrices used for when rendering to the texture

	// Caculate the view matrix
	m_mR2TView = PVRTMat4::LookAtRH(PVRTVec3(0, 0, 60), PVRTVec3(0, 0, 0), PVRTVec3(0, 1, 0));

	// Calculate the projection matrix
	// Note: As we'll be rendering to a texture we don't need to take the screen rotation into account
	m_mR2TProjection = PVRTMat4::PerspectiveFovRH(1, 1, g_fCameraNear, g_fCameraFar, PVRTMat4::OGL, false);

	// Setup view and projection matrices used for when rendering the main scene

	// Caculate the view matrix
	m_mView = PVRTMat4::LookAtRH(PVRTVec3(0, 0, 125), PVRTVec3(0, 0, 0), PVRTVec3(0, 1, 0));

	// Calculate the projection matrix
	m_mProjection = PVRTMat4::PerspectiveFovRH(PVRT_PI/6, (float)PVRShellGet(prefWidth)/(float)PVRShellGet(prefHeight), g_fCameraNear, g_fCameraFar, PVRTMat4::OGL, bRotate);

	return true;
}
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:76,代码来源:OGLESRenderToTexture.cpp

示例10: 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 OGLES2PVRScopeRemote::InitView()
{
	CPPLProcessingScoped PPLProcessingScoped(m_psSPSCommsData,
		__FUNCTION__, static_cast<unsigned int>(strlen(__FUNCTION__)), m_i32FrameCounter);

	CPVRTString ErrorStr;

	/*
		Initialize VBO data
	*/
	LoadVbos();

	/*
		Load textures
	*/
	if (!LoadTextures(&ErrorStr))
	{
		PVRShellSet(prefExitMessage, ErrorStr.c_str());
		return false;
	}

	// Take our initial vert shader source
	{
		CPVRTResourceFile VertShaderFile(c_szVertShaderSrcFile);
		m_pszVertShader = new char[VertShaderFile.Size() + 1];
		strncpy(m_pszVertShader, (char*)VertShaderFile.DataPtr(), VertShaderFile.Size());
		m_pszVertShader[VertShaderFile.Size()] = 0;
	}
	// Take our initial frag shader source
	{
		CPVRTResourceFile FragShaderFile(c_szFragShaderSrcFile);
		m_pszFragShader = new char[FragShaderFile.Size() + 1];
		strncpy(m_pszFragShader, (char*)FragShaderFile.DataPtr(), FragShaderFile.Size());
		m_pszFragShader[FragShaderFile.Size()] = 0;
	}

	/*
		Load and compile the shaders & link programs
	*/
	if (!LoadShaders(&ErrorStr, m_pszFragShader, m_pszVertShader))
	{
		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
	*/

	m_mProjection = PVRTMat4::PerspectiveFovRH(PVRT_PI/6, (float)PVRShellGet(prefWidth)/(float)PVRShellGet(prefHeight), CAM_NEAR, CAM_FAR, PVRTMat4::OGL, bRotate);

	m_mView = PVRTMat4::LookAtRH(PVRTVec3(0, 0, 75), PVRTVec3(0, 0, 0), PVRTVec3(0, 1, 0));

	/*
		Set OpenGL ES render states needed for this training course
	*/
	// Enable backface culling and depth test
	glCullFace(GL_BACK);
	glEnable(GL_CULL_FACE);

	glEnable(GL_DEPTH_TEST);

	// Use a nice bright blue as clear colour
	glClearColor(0.6f, 0.8f, 1.0f, 1.0f);

	return true;
}
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:87,代码来源:OGLES2PVRScopeRemote.cpp

示例11: InitView

/*!****************************************************************************
 @Function		InitView
 @Return		bool		true if no error occurred
 @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 OGLES2ParallaxBumpMap::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, "basemap"), 0);
	glUniform1i(glGetUniformLocation(m_ShaderProgram.uiId, "normalmap"), 1);
	glUniform1i(glGetUniformLocation(m_ShaderProgram.uiId, "heightmap"), 2);

	// 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_mView = PVRTMat4::LookAtRH(PVRTVec3(0, 0, 150), PVRTVec3(0, 0, 0), PVRTVec3(0, 1, 0));
	m_mViewProj = PVRTMat4::PerspectiveFovFloatDepthRH(CAM_FOV, fAspect, CAM_NEAR, PVRTMat4::OGL, bRotate);
	m_mViewProj *= m_mView;

	/*
		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);

	return true;
}
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:79,代码来源:OGLES2ParallaxBumpMap.cpp

示例12: 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 OGLESIntroducingPFX::InitView()
{
	/*
		Initialize Print3D
	*/
	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;
	}

	// Sets the clear color
	glClearColor(0.6f, 0.8f, 1.0f, 1.0f);

	// Enables depth test using the z-buffer
	glEnable(GL_DEPTH_TEST);

	/*
		Loads the light direction from the scene.
	*/
	// We check the scene contains at least one
	if (m_Scene.nNumLight == 0)
	{
		PVRShellSet(prefExitMessage, "ERROR: The scene does not contain a light\n");
		return false;
	}

	/*
		Load the effect file
	*/
	{
		unsigned int	nUnknownUniformCount;
		CPVRTString	error;

		// Parse the file
		m_pEffectParser = new CPVRTPFXParser;
		if(m_pEffectParser->ParseFromFile(c_szPfxFile, &error) != PVR_SUCCESS)
		{
			PVRShellSet(prefExitMessage, error.c_str());
			return false;
		}

		// Load an effect from the file
		m_pEffect = new CPVRTPFXEffect();
		if(m_pEffect->Load(*m_pEffectParser, "Effect", c_szPfxFile, &error) != PVR_SUCCESS)
		{
			PVRShellSet(prefExitMessage, error.c_str());
			return false;
		}

		// Generate uniform array
		if(m_pEffect->BuildUniformTable(
			&m_psUniforms, &m_nUniformCnt, &nUnknownUniformCount,
			c_psUniformSemantics, sizeof(c_psUniformSemantics) / sizeof(*c_psUniformSemantics),
			&error) != PVR_SUCCESS)
		{
			PVRShellOutputDebug(error.c_str());
			return false;
		}
		if(nUnknownUniformCount)
		{
			PVRShellOutputDebug(error.c_str());
			PVRShellOutputDebug("Unknown uniform semantic count: %d\n", nUnknownUniformCount);
		}
	}

	/*
		Loads the textures.
		For a more detailed explanation, see Texturing and IntroducingPVRTools
	*/
	{
		const SPVRTPFXTexture	*psTex;
		unsigned int			nCnt, i;
		GLuint					ui;

		psTex = m_pEffect->GetTextureArray(nCnt);

		for(i = 0; i < nCnt; ++i)
		{
			if(strcmp(psTex[i].p, "Reflection.pvr") == 0)
			{
				if(PVRTTextureLoadFromPVR(c_szReflectTexFile, &ui) != PVR_SUCCESS)
				{
					PVRShellSet(prefExitMessage, "ERROR: Cannot load the texture\n");
					return false;
				}
			
				glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
				glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

//.........这里部分代码省略.........
开发者ID:anonymousjustice,项目名称:pvr-pi,代码行数:101,代码来源:OGLES2IntroducingPFX.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 OGLES3Texturing::InitView()
{
    // Fragment and vertex shaders code
    const char* pszFragShader = "\
		#version 300 es\n\
		uniform sampler2D sampler2d;\
		in mediump vec2	myTexCoord;\
		layout (location = 0) out lowp vec4 oColour;\
		void main (void)\
		{\
		    oColour = texture(sampler2d,myTexCoord);\
		}";
    const char* pszVertShader = "\
		#version 300 es\n\
		#define VERTEX_ARRAY 0\n\
		#define TEXCOORD_ARRAY 1\n\
		layout (location = VERTEX_ARRAY) in highp vec4	myVertex;\
		layout (location = TEXCOORD_ARRAY) in highp vec2	myUV;\
		uniform mediump mat4	myPMVMatrix;\
		out mediump vec2	myTexCoord;\
		void main(void)\
		{\
			gl_Position = myPMVMatrix * myVertex;\
			myTexCoord = myUV;\
		}";

    // Create the fragment shader object
    m_uiFragShader = glCreateShader(GL_FRAGMENT_SHADER);

    // Load the source code into it
    glShaderSource(m_uiFragShader, 1, (const char**)&pszFragShader, NULL);

    // Compile the source code
    glCompileShader(m_uiFragShader);

    // Check if compilation succeeded
    GLint bShaderCompiled;
    glGetShaderiv(m_uiFragShader, GL_COMPILE_STATUS, &bShaderCompiled);
    if (!bShaderCompiled)
    {
        // An error happened, first retrieve the length of the log message
        int i32InfoLogLength, i32CharsWritten;
        glGetShaderiv(m_uiFragShader, GL_INFO_LOG_LENGTH, &i32InfoLogLength);

        // Allocate enough space for the message and retrieve it
        char* pszInfoLog = new char[i32InfoLogLength];
        glGetShaderInfoLog(m_uiFragShader, i32InfoLogLength, &i32CharsWritten, pszInfoLog);

        /*
        	Displays the message in a dialog box when the application quits
        	using the shell PVRShellSet function with first parameter prefExitMessage.
        */
        char* pszMsg = new char[i32InfoLogLength+256];
        strcpy(pszMsg, "Failed to compile fragment shader: ");
        strcat(pszMsg, pszInfoLog);
        PVRShellSet(prefExitMessage, pszMsg);

        delete [] pszMsg;
        delete [] pszInfoLog;
        return false;
    }

    // Loads the vertex shader in the same way
    m_uiVertexShader = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(m_uiVertexShader, 1, (const char**)&pszVertShader, NULL);
    glCompileShader(m_uiVertexShader);
    glGetShaderiv(m_uiVertexShader, GL_COMPILE_STATUS, &bShaderCompiled);
    if (!bShaderCompiled)
    {
        int i32InfoLogLength, i32CharsWritten;
        glGetShaderiv(m_uiVertexShader, GL_INFO_LOG_LENGTH, &i32InfoLogLength);
        char* pszInfoLog = new char[i32InfoLogLength];
        glGetShaderInfoLog(m_uiVertexShader, i32InfoLogLength, &i32CharsWritten, pszInfoLog);
        char* pszMsg = new char[i32InfoLogLength+256];
        strcpy(pszMsg, "Failed to compile vertex shader: ");
        strcat(pszMsg, pszInfoLog);
        PVRShellSet(prefExitMessage, pszMsg);

        delete [] pszMsg;
        delete [] pszInfoLog;
        return false;
    }

    // Create the shader program
    m_uiProgramObject = glCreateProgram();

    // Attach the fragment and vertex shaders to it
    glAttachShader(m_uiProgramObject, m_uiFragShader);
    glAttachShader(m_uiProgramObject, m_uiVertexShader);

    // Bind the custom vertex attribute "myVertex" to location VERTEX_ARRAY
    glBindAttribLocation(m_uiProgramObject, VERTEX_ARRAY, "myVertex");
//.........这里部分代码省略.........
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:101,代码来源:OGLES3Texturing.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

示例15: 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


注:本文中的PVRShellSet函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。