Files
XCSDD/docs/api/rhi/opengl/shader/get-uniform-location.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
2026-03-19 12:44:08 +08:00

494 B

OpenGLShader::GetUniformLocation

int GetUniformLocation(const char* name) const;

获取 Uniform 变量的位置索引。

参数:

  • name - Uniform 变量名称

返回: Uniform 位置索引,失败返回 -1

线程安全:

示例:

int loc = shader->GetUniformLocation("modelMatrix");
if (loc != -1) {
    glUniformMatrix4fv(loc, 1, GL_FALSE, &modelMatrix[0][0]);
}

相关文档