| 390 | } |
| 391 | |
| 392 | std::string Program::getActiveUniformName(const GLuint uniformIndex) const |
| 393 | { |
| 394 | checkDirty(); |
| 395 | |
| 396 | GLint length = getActiveUniform(uniformIndex, GL_UNIFORM_NAME_LENGTH); |
| 397 | assert(length > 1); // Has to include at least 1 char and '\0' |
| 398 | |
| 399 | std::vector<char> name(length); |
| 400 | glGetActiveUniformName(id(), uniformIndex, length, nullptr, name.data()); |
| 401 | |
| 402 | // glGetActiveUniformName() insists we query '\0' as well, but it |
| 403 | // shouldn't be passed to std::string(), otherwise std::string::size() |
| 404 | // returns <actual size> + 1 (on clang) |
| 405 | auto numChars = length - 1; |
| 406 | return std::string(name.data(), numChars); |
| 407 | } |
| 408 | |
| 409 | UniformBlock * Program::uniformBlock(const GLuint uniformBlockIndex) |
| 410 | { |