本文整理汇总了C++中SkyBox::getUniformLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ SkyBox::getUniformLocation方法的具体用法?C++ SkyBox::getUniformLocation怎么用?C++ SkyBox::getUniformLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkyBox
的用法示例。
在下文中一共展示了SkyBox::getUniformLocation方法的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);
}