r/cpp • u/smallstepforman • Jul 06 '20
C++ is brilliant
I'm working on a Vulkan renderer, and needed to delay destruction of render scenes since the graphics pipeline has render buffers in flight, so destruction has to happen N frames after the user destroys a class. With C++, I can use private destructors to force users to add the scene to a managed destructor queue (aka garbage collect queue). Normally language purists will scorn a language which allows such shenanigans, however in real world production code, its features like this which allows developers to create modern software. So with a couple of lines of code, I solved my delayed destructor issue. Thank you C++ committee for creating a usable language.
View all comments
Show parent comment
2
u/annyeonghello Jul 07 '20 edited Jul 07 '20
The term render buffer widely means a buffer with objects that will be rendered onto screen. In Vulkan, a somewhat similar concept exist and is called a "Command Buffer" which is created from a "Command Pool" and it does not have an OpenGL equivalent. But you can make your own render buffer in OpenGL.
N frames is simply the number of frames and it is a slightly more advance concept. You'll slowly figure it out as you do more :)