Important: Please read the Qt Code of Conduct -

QOpenGLShaderProgram setAttributeArray() - Correct Usage?

  • Looking at the documentation for setAttributeArray() on QOpenGLShaderProgram, it looks as though the function always requires a pointer to the values used for drawing (GLfloat or some variant of QVector*D). Why is this? It was my understanding that uploading the vertex data to the GPU is done elsewhere with glBufferData() and isn't related to this part of the shader program - the bits of pure OpenGL that I'd done before this just catered to setting the format of the attributes (size, stride, offset). How should I be using this function correctly?

Log in to reply