Hello folks! Recently I stumbled upon this very weird issue where I try to create a buffer but then it's immediately after. I definitely do not call it. What could be causing this weird behavior. Thanks in advance!
RELEVANT PART OF APITRACE DUMP
4420 glCreateBuffers(n = 1, buffers = &1)
4421 glDeleteBuffers(n = 1, buffers = &1)
These next 2 code blocks are from 2 separate code blocks but they are executed back-to-back with no code executed in between. It's also worth noting that I double checked and the pointer is valid throughout.
if(isInstanced){
instanceVBO.reset(new GLuint);
instanceCount.reset(new uint32_t);
glCreateBuffers(1, instanceVBO.get());
printf("%i\n", glIsBuffer(instanceVBO.get()[0])); // THE BUFFER IS VALID HERE
}
void Sprite::UpdateInstancedArray(std::vector<glm::vec2> instances){
glBindVertexArray(0);
std::vector<float> instancesRaw;
for(glm::vec2 instance : instances){
instancesRaw.push_back(instance.x);
instancesRaw.push_back(instance.y);
}
glBindBuffer(GL_ARRAY_BUFFER, instanceVBO.get()[0]);
printf("%i\n", glIsBuffer(instanceVBO.get()[0])); // BUT NOT HERE??
glBufferData(GL_ARRAY_BUFFER, sizeof(float)*instancesRaw.size(), instancesRaw.data(), GL_DYNAMIC_DRAW);
Also if I just remove the glCreateBuffers
part entirely OpenGL still tries to delete something…
4420 glDeleteBuffers(n = 1, buffers = NULL) // incomplete