Search code examples
c++devil

Why generate resource names in OpenGL and DevIL?


Just reading the DevIL manual here. Also reminded me of glGenBuffers. Why did they choose to have the user of each library generate names (pg. 6 in the DevIL manual), rather than specifying names for your own images/buffers and so on?

I thought maybe they're trying to keep things simpler, automation-wise, for when you need to load large batches of images. But I'm not sure that's a sensible conclusion. Probably there's some incredibly straightforward answer that I will smack myself on the forehead for not seeing.


Solution

  • From here:

    The process is as follows: first, use glGenBuffersARB to get a valid VBO "name". Essentially, a name is an ID number which OpenGL will associate with your data. We want to generate a name because the same ones won't always be available.