本文整理汇总了C++中TextureManager::BindTextureCubeMap方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureManager::BindTextureCubeMap方法的具体用法?C++ TextureManager::BindTextureCubeMap怎么用?C++ TextureManager::BindTextureCubeMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureManager
的用法示例。
在下文中一共展示了TextureManager::BindTextureCubeMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
//function to render stuff
void Object::render(const GLuint& program, TextureManager& textureManager){
//Note to self : very very important!!! Otherwise you won't see anything!
glUseProgram(program);
//bind the current object's texture
for (auto iter = m_textureHandles.begin(); iter != m_textureHandles.end(); iter++)
{
if (cubemap)
{
textureManager.BindTextureCubeMap(iter->first, iter->second, program);
}
else
{
textureManager.BindTexture2D(iter->first, iter->second, program);
}
}
//set the uniforms
glUniform1i(glGetUniformLocation(program, "lightSwitch"), lightSwitch);
glUniform4fv(glGetUniformLocation(program, "diffuseColor"), 1, diffuse);
glm::mat4 scaleMatrix = glm::scale(glm::mat4(1.0f), glm::vec3(scale[0], scale[1], scale[2]));
glm::mat4 translateMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(translate[0], translate[1], translate[2]));
glm::mat4 rotationMatrix_X = glm::rotate(glm::mat4(1.0f), angle[0], glm::vec3(1.0f, 0.0f, 0.0f));
glm::mat4 rotationMatrix_Y = glm::rotate(glm::mat4(1.0f), angle[1], glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 rotationMatrix_Z = glm::rotate(glm::mat4(1.0f), angle[2], glm::vec3(0.0f, 0.0f, 1.0f));
glm::mat4 modelMatrix = scaleMatrix * translateMatrix * rotationMatrix_X * rotationMatrix_Y * rotationMatrix_Z;
glUniformMatrix4fv(glGetUniformLocation(program, "model"), 1, false, glm::value_ptr(modelMatrix));
//bind the vao and draw the triangles
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, 0, faces.size() * 3 * 3);
textureManager.unbindAllTextures();
glUseProgram(0);
}