- 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
28 lines
494 B
Markdown
28 lines
494 B
Markdown
# OpenGLShader::GetUniformLocation
|
|
|
|
```cpp
|
|
int GetUniformLocation(const char* name) const;
|
|
```
|
|
|
|
获取 Uniform 变量的位置索引。
|
|
|
|
**参数:**
|
|
- `name` - Uniform 变量名称
|
|
|
|
**返回:** Uniform 位置索引,失败返回 -1
|
|
|
|
**线程安全:** ❌
|
|
|
|
**示例:**
|
|
|
|
```cpp
|
|
int loc = shader->GetUniformLocation("modelMatrix");
|
|
if (loc != -1) {
|
|
glUniformMatrix4fv(loc, 1, GL_FALSE, &modelMatrix[0][0]);
|
|
}
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [OpenGLShader 总览](shader.md) - 返回类总览
|