本文整理汇总了C++中Shader::GetUniform方法的典型用法代码示例。如果您正苦于以下问题:C++ Shader::GetUniform方法的具体用法?C++ Shader::GetUniform怎么用?C++ Shader::GetUniform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shader
的用法示例。
在下文中一共展示了Shader::GetUniform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitializeUniforms
void PointLightPositionRenderer::InitializeUniforms(Shader & shader)
{
const char * uniformNames[__uniforms_count__] =
{
"u_InnerTessLevel",
"u_OuterTessLevel",
"u_LightDescSampler",
"u_LightDataSampler",
"u_LightOffset",
};
shader.Use();
shader.AddUniforms(uniformNames, __uniforms_count__);
glUniform1i(shader.GetUniform(u_LightDescSampler), 0);
glUniform1i(shader.GetUniform(u_LightDataSampler), 1);
glUniform1f(shader.GetUniform(u_InnerTessLevel), 1.f);
glUniform1f(shader.GetUniform(u_OuterTessLevel), 1.f);
shader.SetupFrameDataBlockBinding();
shader.UnUse();
GL_CHECK_ERRORS;
}
示例2: InternalRender
void SpotLightPositionRenderer::InternalRender(Shader & shader, GLsizei instanceCount, GLint lightOffset, GLuint lightDescBufferId, GLuint lightDataBufferId)
{
glDisable(GL_CULL_FACE);
shader.Use();
glBindVertexArray(mVaoID);
glUniform1i(shader.GetUniform(u_LightOffset), lightOffset);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_BUFFER, lightDescBufferId);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_BUFFER, lightDataBufferId);
glDrawArraysInstanced(GL_TRIANGLE_FAN, 0, mIndexCount, instanceCount);
glBindVertexArray(0);
shader.UnUse();
glEnable(GL_CULL_FACE);
}