- This topic has 1 reply, 2 voices, and was last updated 7 years, 12 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Using SOFA › [SOLVED] is GLSL 4 compatible with current OglModel/OglShader?
Tagged: 64_bits, GLSL OglModel, SOFA_1512, Windows_10
Hi all,
I am a beginner on writing OpenGL shaders. Currently i am writing #version 420 shader files for rendering the OglModel. But i found the OglModel.cpp was written an older version OpenGL, which is a little different from the online opengl tutorials i have learned.
I want to use the this kind of input “layout(location = attribute index) in vec3 position”. Is this compatible with the current cpp files()? If yes, how should i find out the right “attribute index”?
Thanks!
–Ruiliang
Hello,
Unfortunately, OglModel (and other visual components) was made using the old OpenGL pipeline. As such, there is no call for glEnableVertexAttribArray which indicates which “index” is linked with “what” (vertices, normals, etc).
It MAY be possible to execute your shader anyway, according to the doc:
Automatic assignment
If neither of the prior two methods assign an input to an attribute index, then the index is automatically assigned by OpenGL when the program is linked. The index assigned is completely arbitrary and may be different for different programs that are linked, even if they use the exact same vertex shader code.
But as you can read, it is not really safe…
Anyway, the project to port the code to OpenGL4 (Core Profile) is underway but it will take time :-/
Regards.
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.