|
25 | 25 |
|
26 | 26 | #include <string.h>
|
27 | 27 |
|
| 28 | +#include <vector> |
| 29 | + |
28 | 30 | //--------------------------------------------------------------------------------
|
29 | 31 | // Teapot model data
|
30 | 32 | //--------------------------------------------------------------------------------
|
@@ -152,15 +154,17 @@ void MoreTeapotsRenderer::Init(const int32_t numX, const int32_t numY,
|
152 | 154 | int32_t num_indices;
|
153 | 155 | glGetActiveUniformBlockiv(shader_param_.program_, blockIndex,
|
154 | 156 | GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &num_indices);
|
155 |
| - GLint i[num_indices]; |
156 |
| - GLint stride[num_indices]; |
| 157 | + std::vector<GLint> indices(num_indices); |
| 158 | + std::vector<GLint> strides(num_indices); |
157 | 159 | glGetActiveUniformBlockiv(shader_param_.program_, blockIndex,
|
158 |
| - GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, i); |
159 |
| - glGetActiveUniformsiv(shader_param_.program_, num_indices, (GLuint*)i, |
160 |
| - GL_UNIFORM_ARRAY_STRIDE, stride); |
161 |
| - |
162 |
| - ubo_matrix_stride_ = stride[0] / sizeof(float); |
163 |
| - ubo_vector_stride_ = stride[2] / sizeof(float); |
| 160 | + GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, |
| 161 | + indices.data()); |
| 162 | + glGetActiveUniformsiv(shader_param_.program_, num_indices, |
| 163 | + (GLuint*)indices.data(), GL_UNIFORM_ARRAY_STRIDE, |
| 164 | + strides.data()); |
| 165 | + |
| 166 | + ubo_matrix_stride_ = strides.at(0) / sizeof(float); |
| 167 | + ubo_vector_stride_ = strides.at(2) / sizeof(float); |
164 | 168 |
|
165 | 169 | glGenBuffers(1, &ubo_);
|
166 | 170 | glBindBuffer(GL_UNIFORM_BUFFER, ubo_);
|
|
0 commit comments