SoContextHandler(3)

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

πŸ’– SoContextHandler(3) πŸ’–

Library Functions Manual · the Coin crew said hi and also this page exists ✨


🌸 NAME 🌸

SoContextHandler β€” okay so bestie, for now this class is literally to be treated as an internal class. That's the whole vibe. Not for you. Yet. πŸ™ˆ


πŸŽ€ SYNOPSIS πŸŽ€

#include <Inventor/misc/SoContextHandler.h>

πŸ¦‹ Public Types

  • typedef void ContextDestructionCB(uint32_t contextid, void *userdata) β€” the callback shape, slay

πŸ’… 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 ✨

The SoContextHandler class is, for now, to be treated as an internal class. That's it, that's the description, we're keeping it real fr fr. πŸ’œ

Since : Coin 2.0 ⭐


πŸ‘‘ Member Function Documentation πŸ‘‘

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

So like, this method must be called by client code that destructs a context β€” mandatory, no skips β€” to guarantee that there are no memory leaks upon context destruction. Leaks are not the vibe. πŸ’€

This will take care of correctly freeing context-bound resources, like OpenGL texture objects and display lists. Iconic behaviour honestly.

⚠️ Before calling this function, the context must be made current. Do not forget this part bestie, it's giving important.

Also note: if you're using one of the standard GUI-binding libraries from Systems in Motion, this is taken care of automatically for contexts for canvases set up by SoQt, SoWin, etc. So you can just chill. 🫢

References: SbList< Type >::getArrayPtr(), and SbList< Type >::getLength().


🌈 void SoContextHandler::addContextDestructionCallback (ContextDestructionCB *func, void *closure) [static]

Add a callback which will be called every time a GL context is destructed. The callback should delete all GL resources tied to that context. Clean up after yourself, main character energy. 🧹✨

All nodes/classes that allocate GL resources should set up a callback like this. The way to do it: add the callback in the constructor of the node/class, and remove it in the destructor. Balanced. Symmetrical. We love to see it. πŸ‘‘

See also: removeContextDestructionCallback()


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

Remove a context destruction callback. Goodbye callback, you did great. 😭

See also: addContextDestructionCallback()


⭐ Author ⭐

Generated automatically by Doxygen for Coin from the source code. Not a human, just a robot doing its lil thing. πŸ€–πŸ’…


and that's the whole page bestie, hope it slayed πŸŒΈπŸ¦‹βœ¨

Coin Β· Version 2.5.0 Β· SoContextHandler(3) β€” mwah, take care of your contexts πŸ’–

πŸ“¦ where this page comes from