-
Notifications
You must be signed in to change notification settings - Fork 59
Description
Hello,
please have look on the following piece of code
globjects::VertexArray::hintAttributeImplementation(globjects::VertexArray::AttributeImplementation::DirectStateAccessARB);
auto pVertexBuffer = globjects::Buffer::create();
pVertexBuffer->setStorage(vertices, gl::BufferStorageMask::GL_MAP_READ_BIT);
auto pIndexBuffer = globjects::Buffer::create();
pIndexBuffer->setStorage(indices, gl::BufferStorageMask::GL_MAP_READ_BIT);
//pVertexArray->bind();
auto pBinding1 = pVertexArray->binding(0);
pBinding1->setBuffer(pVertexBuffer.get(), 0, sizeof(v3v3));
pBinding1->setAttribute(0);
When runing this code, I get the following error/debug message.
does not refer to an existing vertex array object.
If I call pVertexArray->bind(); before setting the buffer and attributes format, everyhting is fine so far. But VAO with use of DSA usually do not need to bind before setting the buffer or attributes format. Is this by design ?
In plain OpenGL this would be something like this here
glCreateBuffers(1, &vboId);
glCreateBuffers(1, &iboId);
glCreateVertexArrays(1, &vaoId);
glNamedBufferStorage(vboId, vertices.size() * sizeof(v3v3), vertices.data(), GL_MAP_READ_BIT);
glNamedBufferStorage(iboId, indices.size() * sizeof(uint32_t), indices.data(), GL_MAP_READ_BIT);
glVertexArrayVertexBuffer(vaoId, 0, vboId, 0, sizeof(v3v3));
glVertexArrayElementBuffer(vaoId, iboId);
glEnableVertexArrayAttrib(vaoId, 0);
glVertexArrayAttribFormat(vaoId, 0, 3, GL_FLOAT, GL_FALSE, 0);
glVertexArrayAttribBinding(vaoId, 0, 0);
glEnableVertexArrayAttrib(vaoId, 1);
glVertexArrayAttribFormat(vaoId, 1, 3, GL_FLOAT, GL_FALSE, offsetof(v3v3, color));
glVertexArrayAttribBinding(vaoId, 1, 0);
kind regards,