SOXTGLWIDGET(3iv)

πŸ’– SoXtGLWidget πŸ’–

okay so bestie, welcome to the SoXtGLWidget(3IV) manual page β€” yes, that's the manual name right there, section 3IV, and it's giving deep lore energy. this is the one that wraps GLwMDraw so you can do OpenGL rendering inside a motif widget. slay. πŸŽ€


🌸 INHERITS FROM 🌸

SoXtComponent > SoXtGLWidget

so it's a whole family tree situation β€” SoXtGLWidget is the child, SoXtComponent is the parent, and it's inheriting all that main character energy. πŸ‘‘


✨ SYNOPSIS ✨

#include <Inventor/Xt/SoXtGLWidget.h>

🫢 Methods from class SoXtGLWidget:

void                setBorder(SbBool onOrOff)
SbBool              isBorder() const
virtual void        setDoubleBuffer(SbBool onOrOff)
SbBool              isDoubleBuffer()
Window              getNormalWindow()
Window              getOverlayWindow()
GLXContext          getNormalContext()
GLXContext          getOverlayContext()
Widget              getNormalWidget()
Widget              getOverlayWidget()
virtual void        setNormalVisual(XVisualInfo *vis)
XVisualInfo *       getNormalVisual()
virtual void        setOverlayVisual(XVisualInfo *vis)
XVisualInfo *       getOverlayVisual()
void                setDrawToFrontBufferEnable(SbBool enableFlag)
SbBool              isDrawToFrontBufferEnable() const

πŸ¦‹ Methods from class SoXtComponent:

virtual void            show()
virtual void            hide()
SbBool                  isVisible()
Widget                  getWidget() const
SbBool                  isTopLevelShell() const
Widget                  getShellWidget() const
Widget                  getParentWidget() const
void                    setSize(const SbVec2s &size)
SbVec2s                 getSize()
Display *               getDisplay()
void                    setTitle(const char *newTitle)
const char *            getTitle() const
void                    setIconTitle(const char *newIconTitle)
const char *            getIconTitle() const
void                    setWindowCloseCallback(SoXtComponentCB *func, void
                             *data = NULL)
static SoXtComponent *  getComponent(Widget w)
const char *            getWidgetName() const
const char *            getClassName() const

🌈 DESCRIPTION 🌈

okay so here's the tea. This abstract base class is literally a C++ wrapper around the GLwMDraw widget. it lets you do OpenGL rendering inside a motif widget, and it's the blueprint that SoXtRenderArea uses. πŸ’…

SoXtGLWidget uses a form widget around two separate GLwMDraw widgets β€” one for single buffering, one for double buffering β€” and it's got routines to hand you back the appropriate windows. two widgets, one vibe. it's giving duality. ✨

and here's the part where the subclasses get to shine: subclasses only need to redefine the redraw() routine for rendering, plus the processEvent() routine if they're interested in receiving X events. that's it. that's the homework. no cap. πŸ“


πŸ’… METHODS πŸ’…

πŸŽ€ setBorder / isBorder

void                setBorder(SbBool onOrOff)
SbBool              isBorder() const

show and hide the border around the glx widgets (thickness 3). default is no border (FALSE). and lowkey a fun lil plot twist: the SoXtRenderArea subclass defaults turns the border on by default. so if you're confused why your SoXtRenderArea looks framed and your plain SoXtGLWidget doesn't β€” that's why bestie. πŸ–ΌοΈ


πŸŽ€ setDoubleBuffer / isDoubleBuffer

virtual void        setDoubleBuffer(SbBool onOrOff)
SbBool              isDoubleBuffer()

the routine that dynamically changes between single and double buffering. default is double buffer off. (and yup, the SoXtRenderArea subclass makes it double buffer by default.) flip it whenever, it's dynamic, it's flexible, it's iconic. πŸ”„


πŸŽ€ getNormalWindow / getOverlayWindow / getNormalContext / getOverlayContext / getNormalWidget / getOverlayWidget

Window              getNormalWindow()
Window              getOverlayWindow()
GLXContext          getNormalContext()
GLXContext          getOverlayContext()
Widget              getNormalWidget()
Widget              getOverlayWidget()

grab the current normal and overlay GLX windows, contexes and widgets. you need these as arguments to glXMakeCurrent() when you're doing drawing in the normal or overlay planes. πŸ–ŒοΈ

⚠️ Note: These should not be cached by users because they will change as single/double buffering changes. bestie do NOT save these in a variable and walk away, they will betray you. 😭

πŸŽ€ setNormalVisual / getNormalVisual / setOverlayVisual / getOverlayVisual

virtual void        setNormalVisual(XVisualInfo *vis)
XVisualInfo *       getNormalVisual()
virtual void        setOverlayVisual(XVisualInfo *vis)
XVisualInfo *       getOverlayVisual()

specify exactly what the visual should be for the normal and overlay window. this lets you create all possible visuals supported by OpenGL. the XVisualInfo structure should be a valid OpenGL visual returned by glXChooseVisual(). 🎨

so here's the important bit: this structure will be copied by the SoXtGLWidget β€” so the application is responsible for freeing the visual info with XFree() when done. don't forget, fr fr. 🫢

and why are the setting methods virtual? because derived classes can know when the visual is changing. communication, bestie. it's a whole relationship. πŸ’ž


πŸŽ€ setDrawToFrontBufferEnable / isDrawToFrontBufferEnable

void                setDrawToFrontBufferEnable(SbBool enableFlag)
SbBool              isDrawToFrontBufferEnable() const

okay this one has LORE. Inventor 2.1 changed the behavior of double buffered windows to redraw temporary to the front buffer when an expose event is received, or when a new sceneGraph() is set on an SoXtRenderArea. this does not apply for general interactive rendering. 🚫

the idea? it's better to see something redraw (especially if it's slow) than to see garbage in the window (in the expose case), or an old invalid scene graph (in the SoXtRenderArea::setSceneGraph() case). makes sense tbh. seeing garbage is not the vibe. πŸ’€

this API enables you to turn this functionality OFF if, for some reason, you are unable to prevent repeated expose from causing a redraw β€” which is bad and should be fixed, because it gets worse for large scenes. this will be the case for example if you can't create a pulldown menu in the popup planes. πŸ™ˆ

NOTE: this api might be removed in some future releases and is only intended as a porting help for Inventor 2.0 to 2.1. so like… use it, but don't get attached. it's a situationship. 😭

πŸ‘€ SEE ALSO πŸ‘€

SoXtComponent, SoXtRenderArea


and that's the whole page bestie!! πŸ’– this was SoXtGLWidget(3IV) β€” manual name right there, section 3IV, and honestly? the footer's just echoing SoXtGLWidget(3IV)() back at us like a lil mirror selfie with no extra version or date tea attached. go forth and render, you absolute legend. periodt. βœ¨πŸ¦‹πŸŽ€πŸ‘‘πŸŒˆπŸ’