本文整理汇总了C++中Texture::GetHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::GetHandle方法的具体用法?C++ Texture::GetHandle怎么用?C++ Texture::GetHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture::GetHandle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetValue
void Uniform::SetValue(const Texture &texture)
{
AssertLocation();
initialized = true;
// resolved: couple GL_TEXTURE[n] and SetValue(n)
glActiveTexture(GL_TEXTURE0 + index);
glBindTexture(GL_TEXTURE_2D, texture.GetHandle());
//glEnable(GL_TEXTURE_2D);
SetValue(index);
}
示例2: sizeof
void gfx::GraphicsEngine::RenderGeometry(RenderQueue* drawQueue){
glViewport(0, BUTTON_SIZE, (GLsizei)(m_Width * 0.5f), (GLsizei)m_Height - BUTTON_SIZE * 2);
//glDisable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_DEPTH_TEST);
g_ModelBank.ApplyBuffers();
ShaderProgram* prog = g_ShaderBank.GetProgramFromHandle(m_Shader);
prog->Apply();
prog->SetUniformMat4("g_ViewProj", m_Camera.GetViewProjection());
prog->SetUniformVec3("g_Campos", m_Camera.GetPosition());
glm::vec3 lightDir = glm::vec3(0.5f,-1,0.5f);
static float lightangle = 4.0f;
glm::vec4 temp = glm::vec4(lightDir, 0) * glm::rotate(lightangle, glm::vec3(0, 1, 0));
prog->SetUniformVec3("g_LightDir", glm::vec3(temp.x, temp.y, temp.z));
prog->SetUniformVec3("g_CamDir", m_Camera.GetForward());
m_SkyTex->Apply(prog->FetchUniform("g_SkyCubeTex"), 1);
m_IrradianceTex->Apply(prog->FetchUniform("g_IrradianceCubeTex"), 2);
for (auto& object : drawQueue->GetQueue()){
Model model = g_ModelBank.FetchModel(object.Model);
prog->SetUniformMat4("g_World", object.world);
for (auto& mesh : model.Meshes){
Material* mat = g_MaterialBank.GetMaterial(model.MaterialOffset + mesh.Material);
Texture* albedoTex = g_MaterialBank.GetTexture(mat->GetAlbedoTexture());
Texture* normalTex = g_MaterialBank.GetTexture(mat->GetNormalTexture());
Texture* roughnessTex = g_MaterialBank.GetTexture(mat->GetRoughnessTexture());
Texture* metalTex = g_MaterialBank.GetTexture(mat->GetMetalTexture());
prog->SetUniformTextureHandle("g_DiffuseTex", albedoTex->GetHandle(), 0);
prog->SetUniformTextureHandle("g_NormalTex", normalTex->GetHandle(), 3);
prog->SetUniformTextureHandle("g_RoughnessTex", roughnessTex->GetHandle(), 4);
prog->SetUniformTextureHandle("g_MetallicTex", metalTex->GetHandle(), 5);
glDrawElements(GL_TRIANGLES, mesh.Indices, GL_UNSIGNED_INT,
(GLvoid*)(0 + ((model.IndexHandle + mesh.IndexBufferOffset) * sizeof(unsigned int))));
}
}
}