Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Why are the attribute settings functions part of the QOpenGLShaderProgram ?



  • Why are the attribute settings functions (e.g. setAttributBuffer(..) etc.) for an vertex array object (vao) part of the QOpenGLShaderProgram ? It would conclusive to me, if it were part of the QOpenGLVertexArrayObject.

    The point is actual, that i must have a defined shader program at the creation and initalization of the buffers, more precisely in the once called initalization method. Thats o.k. sofar. But when i want the functionality of an changable shaderprogram, maybe as an parameter to the draw method of an 3DModel, i have a problem. Because now i have to bind the buffer objects and make the attribute settings in the rendering loop. This makes the efforts of an vertex array object redundant.


  • Lifetime Qt Champion

    Hi,

    For such design decisions related questions you should rather ask on the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.



  • Right but there is a issue behind that, what i tried to describe. How to handle on that base the functionality of an changeable shaderprogram ? I have an class which defines a 3DModel. It has an initalization and a draw method as membermethods. In the first one i create and setup the buffer objects (vbo, ibo). I want also use a vertex array object (vao), which i create and setup in the intialization function. There are the invocations that i only have to call ones in the sense of an opengl context. But for the setup and activation of the vertex attributs, that the vao is rememebering, i now need a that point a shaderprgram object. In view of an changeable shaderprogram i dont have that as a member of 3DModel class and thereby also not in the initalization function. I give a referenc to a shaderprogram as paramter to the draw method or better to the rendering loop. So as workaround i have to setup the attributs in the rendering loop, which makes the use of an vao redundant.


Log in to reply