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


C++ SkyBox::unbind方法代码示例

本文整理汇总了C++中SkyBox::unbind方法的典型用法代码示例。如果您正苦于以下问题:C++ SkyBox::unbind方法的具体用法?C++ SkyBox::unbind怎么用?C++ SkyBox::unbind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SkyBox的用法示例。


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

示例1: renderSkyBox

//Calls the Skybox render function to render the skybox which is set up to render the skybox in a specific way
//then gets uniforms so that it knows what variables it's accessing the appropriate shader file.
//then passes values to the shader for it to calculate texture coordinates and such then proceeds
//to draw the cube mesh to screen.
void SplashScreen::renderSkyBox()
	{
		skyBoxObject->render();

		Mesh * currentMesh = skyBoxObject->getMesh();
		SkyBox * currentMaterial = (SkyBox*)skyBoxObject->getMaterial();
		if (currentMesh && currentMaterial)
		{
			Camera * cam = mainCamera->getCamera();

			currentMaterial->bind();
			currentMesh->bind();

			GLint cameraLocation = currentMaterial->getUniformLocation("cameraPos");
			GLint viewLocation = currentMaterial->getUniformLocation("view");
			GLint projectionLocation = currentMaterial->getUniformLocation("projection");
			GLint cubeTextureLocation = currentMaterial->getUniformLocation("cubeTexture");

			glUniformMatrix4fv(projectionLocation, 1, GL_FALSE, glm::value_ptr(cam->getProjection()));
			glUniformMatrix4fv(viewLocation, 1, GL_FALSE, glm::value_ptr(cam->getView()));
			glUniform4fv(cameraLocation, 1, glm::value_ptr(cam->getPosition()));
			glUniform1i(cubeTextureLocation, 0);

			glDrawElements(GL_TRIANGLES, currentMesh->getIndexCount(), GL_UNSIGNED_INT, 0);

			currentMaterial->unbind();
		}
		//CheckForErrors();
		GLenum error;
		do{
			error = glGetError();
		} while (error != GL_NO_ERROR);
	}
开发者ID:CallumF15,项目名称:GP2_E-MC-Coursework,代码行数:37,代码来源:SplashScreen.cpp


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