Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is OpenGL telling me I've used GL_STATIC_DRAW when I've specified otherwise?

When I have the debug layer on with OpenGL, I register a callback, that gets called whenever there's anything of note to tell me. It seems not all the messages that are passed to the callback are errors. There's an "OTHER" category, and it seems it outputs these messages whenever you've done something. In my case I create a VBO with:

GLuint VBO_ID;
glGenBuffers(1, &VBO_ID); // The VBO_ID I get back is 3.
glBindBuffer(GL_ARRAY_BUFFER, VBO_ID);
glBufferData(GL_ARRAY_BUFFER, sizeInBytes, vertices, GL_DYNAMIC_COPY);
// At this point the callback is called, which gives the message:

message: Buffer detailed info: Buffer object 3 (bound to GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.

No matter what the usage hint (last argument of glBufferData), this message ALWAYS says the usage hint is GL_STATIC_DRAW. No matter whether I use GL_DYNAMIC_COPY, GL_DYNAMIC_DRAW, GL_STATIC_READ, anything. The message is always the same.

So yeah, I'm really confused about this. Also why does it give this message, it's not a warning as I haven't done anything wrong, it's just a confirmation. I've ended disabling this "OTHER" category of messages otherwise my log just gets filled with these, because it's called whenever I do something.

like image 614
Zebrafish Avatar asked Oct 16 '17 13:10

Zebrafish


1 Answers

  1. Nvidia driver is very verbose if you enable low severity/info/other, feel free to disable those
  2. As stated by others, GL_DYNAMIC_COPY is only a hint and driver is free to ignore it.
  3. Depending on your access pattern to buffer you might see message stating buffer was recreated in different location (host memory, DMA)

Don't worry about that constant, just put GL_STATIC_DRAW. Its leftover from old GL versions. You can also use glBufferStorage where you can more precisely specify buffer usage.

like image 77
Neithy Avatar answered Nov 13 '22 00:11

Neithy