本文整理汇总了C++中ref_ptr::GetUniformLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ ref_ptr::GetUniformLocation方法的具体用法?C++ ref_ptr::GetUniformLocation怎么用?C++ ref_ptr::GetUniformLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ref_ptr
的用法示例。
在下文中一共展示了ref_ptr::GetUniformLocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ApplyTextures
void ApplyTextures(GLState state, ref_ptr<GpuProgram> program)
{
ref_ptr<Texture> tex = state.GetColorTexture();
int8_t colorTexLoc = -1;
if (tex != nullptr && (colorTexLoc = program->GetUniformLocation("u_colorTex")) >= 0)
{
GLFunctions::glActiveTexture(gl_const::GLTexture0);
tex->Bind();
GLFunctions::glUniformValuei(colorTexLoc, 0);
tex->SetFilter(state.GetTextureFilter());
}
else
{
// Some Android devices (Galaxy Nexus) require to reset texture state explicitly.
// It's caused by a bug in OpenGL driver (for Samsung Nexus, maybe others). Normally
// we don't need to explicitly call glBindTexture(GL_TEXTURE2D, 0) after glUseProgram
// in case of the GPU-program doesn't use textures. Here we have to do it to work around
// graphics artefacts. The overhead isn't significant, we don't know on which devices
// it may happen so do it for all Android devices.
#ifdef OMIM_OS_ANDROID
GLFunctions::glActiveTexture(gl_const::GLTexture0);
GLFunctions::glBindTexture(0);
#endif
}
tex = state.GetMaskTexture();
int8_t maskTexLoc = -1;
if (tex != nullptr && (maskTexLoc = program->GetUniformLocation("u_maskTex")) >= 0)
{
GLFunctions::glActiveTexture(gl_const::GLTexture0 + 1);
tex->Bind();
GLFunctions::glUniformValuei(maskTexLoc, 1);
tex->SetFilter(state.GetTextureFilter());
}
else
{
// Some Android devices (Galaxy Nexus) require to reset texture state explicitly.
// See detailed description above.
#ifdef OMIM_OS_ANDROID
GLFunctions::glActiveTexture(gl_const::GLTexture0 + 1);
GLFunctions::glBindTexture(0);
#endif
}
}