SoContextHandler(3)

πŸ“¦ version 3.1.3, in fedora 43, fedora 44

πŸŽ€ SoContextHandler(3) πŸŽ€

ok so this is a page from the Library Functions Manual, and bestie, let me tell you up front: this one's an internal class. Like, backstage pass energy only, no cap. πŸ’…


✨ NAME ✨

SoContextHandler β€” The SoContextHandler class is for now to be treated as an internal class.


🌸 SYNOPSIS 🌸

#include <Inventor/misc/SoContextHandler.h>

πŸ¦‹ Public Types πŸ¦‹

typedef void ContextDestructionCB(uint32_t contextid, void *userdata)

πŸ’– Static Public Member Functions πŸ’–

static void destructingContext (uint32_t contextid)
static void addContextDestructionCallback (ContextDestructionCB *func,
    void *closure)
static void removeContextDestructionCallback (ContextDestructionCB
    *func, void *closure)

🌈 Detailed Description 🌈

So the SoContextHandler class is, for now, to be treated as an internal class. That's the whole vibe. She's not here to be your bestie yet, she's here to do a job. 🫢

Since

Coin 2.0


πŸ‘‘ Member Function Documentation πŸ‘‘

πŸ’« void SoContextHandler::destructingContext (uint32_t contextid) [static]

Okay this one MATTERS. This method must be called by client code which destructs a context β€” and the reason is that it's the only way to guarantee there are no memory leaks upon context destruction. No leaks, periodt. πŸ’€

What it does is take care of correctly freeing context-bound resources, like OpenGL texture objects and display lists. Iconic cleanup behavior honestly. 🧹✨

⚠️ Before calling this function, the context must be made current. Do not skip this step, bestie, I am begging.

Also, a lil note: if you're using one of the standard GUI-binding libraries from Kongsberg Oil & Gas Technologies, this is taken care of automatically for contexts for canvases set up by SoQt, SoWin, etc. So like, if that's you, you're already slaying and you can chill. 😌

πŸ’« void SoContextHandler::addContextDestructionCallback (ContextDestructionCB * func, void * closure) [static]

Add a callback which will be called every single time a GL context is destructed. The callback should delete all GL resources tied to that context. That's the assignment. πŸ“‹

All nodes/classes that allocate GL resources should set up a callback like this. The move is: add the callback in the constructor of the node/class, and remove it in the destructor. Symmetry, we love to see it. πŸ¦‹

See also

removeContextDestructionCallback()

πŸ’« void SoContextHandler::removeContextDestructionCallback (ContextDestructionCB * func, void * closure) [static]

Remove a context destruction callback. That's it, that's the function. Clean, simple, no notes. ✨

See also

addContextDestructionCallback()


πŸ“ Author πŸ“

Generated automatically by Doxygen for Coin from the source code. (Yeah, Doxygen wrote this, not a person. Respect the automation. πŸ€–πŸ’…)


mwah, that's the whole page bestie, hope it ate πŸ’–

Coin β€” Version 3.1.3 β€” SoContextHandler(3) πŸŒΈπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from