Fra
Fra

Reputation: 423

OpenGL VBO handles

Is it safe to pass integer handles to multiple VBO's that I create to other classes to use?

My main Class creates a bunch of handles with gllenbuffers. I then pass these handles down to sub-classes and store them in variables in that class. Inside that class is where data is actually uploaded via glbufferdata.

Is this okay?

Upvotes: 0

Views: 175

Answers (1)

pyj
pyj

Reputation: 1499

The integer handles are just names that OpenGL uses to uniquely identify the VBOs, so yes. The problem some people run into is when there are multiple OpenGL contexts and you use a VBO from one context in another context, in which that VBO doesn't exist.

Just make sure you have a plan of knowing which element will clean up the handle when you are done using them without leaving other objects with names for invalid VBOs.

Upvotes: 1

Related Questions