The following is a compilation of shaders with the source code characters (indeterminate number of characters), and the type is std::shared_ptr<std::vector<GLchar>>
. Is there a way to make it work like the embedded array GLchart[]?As in the example of the correct answer in the presentation, I would like to know how to write it in one line.
I want to know how to make the std::vector variable behave like the embedded array GLchart[]
Various experiments like the comment section of the presentation code
http://vivi.dyndns.org/tech/cpp/vector.html
Type // std::shared_ptr<std::vector<GLchar>>vertexFile;
//
GLchar*v=vertexFile->data();
// glShaderSource (vertexShader, 1, & v, NULL); // Success Example
// glShaderSource(vertexShader, 1, & (*(GLchar*)vertexFile->data(), NULL);
glShaderSource(vertexShader, 1, &vertexFile->data(),NULL);
The third argument of glShaderSource()
requires an array of GLchar
. std::vector<GLchar>
can only provide an array of GLchar
, so it must be included in the variable once.
In other words, it cannot be simpler than the code in the questionnaire.
© 2024 OneMinuteCode. All rights reserved.