SoQtRenderArea(3)
๐ธ SoQtRenderArea(3) โ the SoQt manual, part 1 ๐ธ
okay bestie, welcome to the SoQt manual page for SoQtRenderArea(3) โ this is part 1 of 3, and it is literally giving โscene graph handling + event managementโ main character energy. ๐
no cap.
โจ NAME โจ
SoQtRenderArea โ the class that adds scene graph handling and event management. periodt.
๐ฆ SYNOPSIS ๐ฆ
#include <Inventor/Qt/SoQtRenderArea.h>
Inherits SoQtGLWidget.
Inherited by SoQtViewer.
๐ Public Member Functions ๐
SoQtRenderArea (QWidget *parent=NULL, const char *name=NULL, SbBool
embed=TRUE, SbBool mouseInput=TRUE, SbBool keyboardInput=TRUE)
~SoQtRenderArea ()
virtual void setSceneGraph (SoNode *scene)
virtual SoNode * getSceneGraph (void)
void setOverlaySceneGraph (SoNode *scene)
SoNode * getOverlaySceneGraph (void)
void setBackgroundColor (const SbColor &color)
const SbColor & getBackgroundColor (void) const
void setBackgroundIndex (int idx)
int getBackgroundIndex (void) const
void setOverlayBackgroundIndex (int idx)
int getOverlayBackgroundIndex (void) const
void setColorMap (int start, int num, const SbColor *colors)
void setOverlayColorMap (int start, int num, const SbColor *colors)
void setViewportRegion (const SbViewportRegion &newRegion)
const SbViewportRegion & getViewportRegion (void) const
void setTransparencyType (SoGLRenderAction::TransparencyType type)
SoGLRenderAction::TransparencyType getTransparencyType (void) const
void setAntialiasing (SbBool smoothing, int numPasses)
void getAntialiasing (SbBool &smoothing, int &numPasses) const
void setClearBeforeRender (SbBool enable, SbBool zbEnable=TRUE)
SbBool isClearBeforeRender (void) const
SbBool isClearZBufferBeforeRender (void) const
void setClearBeforeOverlayRender (SbBool enable)
SbBool isClearBeforeOverlayRender (void) const
void setAutoRedraw (SbBool enable)
SbBool isAutoRedraw (void) const
void setRedrawPriority (uint32_t priority)
uint32_t getRedrawPriority (void) const
void render (void)
void renderOverlay (void)
void scheduleRedraw (void)
void scheduleOverlayRedraw (void)
void redrawOnSelectionChange (SoSelection *selection)
void redrawOverlayOnSelectionChange (SoSelection *selection)
void setEventCallback (SoQtRenderAreaEventCB *func, void *user=NULL)
void setSceneManager (SoSceneManager *manager)
SoSceneManager * getSceneManager (void) const
void setOverlaySceneManager (SoSceneManager *manager)
SoSceneManager * getOverlaySceneManager (void) const
void setGLRenderAction (SoGLRenderAction *action)
SoGLRenderAction * getGLRenderAction (void) const
void setOverlayGLRenderAction (SoGLRenderAction *action)
SoGLRenderAction * getOverlayGLRenderAction (void) const
SbBool sendSoEvent (const SoEvent *event)
void registerDevice (SoQtDevice *device)
void unregisterDevice (SoQtDevice *device)
๐ซถ Public Member Functions inherited from SoQtGLWidget ๐ซถ
void setBorder (const SbBool enable)
SbBool isBorder (void) const
virtual void setDoubleBuffer (const SbBool enable)
SbBool isDoubleBuffer (void) const
void setDrawToFrontBufferEnable (const SbBool enable)
SbBool isDrawToFrontBufferEnable (void) const
void setQuadBufferStereo (const SbBool enable)
SbBool isQuadBufferStereo (void) const
void setAccumulationBuffer (const SbBool enable)
SbBool getAccumulationBuffer (void) const
void setStencilBuffer (const SbBool enable)
SbBool getStencilBuffer (void) const
void setAlphaChannel (const SbBool enable)
SbBool getAlphaChannel (void) const
void setOverlayRender (const SbBool onoff)
SbBool isOverlayRender (void) const
void setSampleBuffers (const int numsamples)
int getSampleBuffers (void) const
void setStealFocus (SbBool enable)
SbBool isStealFocus (void) const
QWidget * getGLWidget (void) const
QWidget * getNormalWidget (void) const
QWidget * getOverlayWidget (void) const
SbBool hasOverlayGLArea (void) const
SbBool hasNormalGLArea (void) const
unsigned long getOverlayTransparentPixel (void)
void getPointSizeLimits (SbVec2f &range, float &granularity)
void getLineWidthLimits (SbVec2f &range, float &granularity)
๐ Public Member Functions inherited from SoQtComponent ๐
virtual SoType getTypeId (void) const
virtual ~SoQtComponent ()
virtual void show (void)
virtual void hide (void)
virtual void setComponentCursor (const SoQtCursor &cursor)
SbBool isFullScreen (void) const
SbBool setFullScreen (const SbBool onoff)
SbBool isVisible (void)
SbBool isTopLevelShell (void) const
QWidget * getWidget (void) const
QWidget * getBaseWidget (void) const
QWidget * getShellWidget (void) const
QWidget * getParentWidget (void) const
void setSize (const SbVec2s size)
SbVec2s getSize (void) const
void setTitle (const char *const title)
const char * getTitle (void) const
void setIconTitle (const char *const title)
const char * getIconTitle (void) const
const char * getWidgetName (void) const
const char * getClassName (void) const
void setWindowCloseCallback (SoQtComponentCB *const func, void *const
user=NULL)
๐ง Public Member Functions inherited from SoQtObject ๐ง
SbBool isOfType (SoType type) const
โญ Static Public Member Functions โญ
static uint32_t getDefaultRedrawPriority (void)
๐ Static Public Member Functions inherited from SoQtComponent ๐
static void initClass (void)
static SoType getClassTypeId (void)
static void setWidgetCursor (QWidget *w, const SoQtCursor &cursor)
static SoQtComponent * getComponent (QWidget *widget)
static void initClasses (void)
๐ Static Public Member Functions inherited from SoQtObject ๐
static void initClass (void)
static SoType getClassTypeId (void)
static void init (void)
๐ Protected Member Functions ๐
SoQtRenderArea (QWidget *parent, const char *name, SbBool embed, SbBool
mouseInput, SbBool keyboardInput, SbBool build)
virtual void redraw (void)
virtual void actualRedraw (void)
virtual void redrawOverlay (void)
virtual void actualOverlayRedraw (void)
virtual SbBool processSoEvent (const SoEvent *const event)
virtual void processEvent (QEvent *event)
virtual void initGraphic (void)
virtual void initOverlayGraphic (void)
virtual void sizeChanged (const SbVec2s &size)
virtual void widgetChanged (QWidget *widget)
virtual void afterRealizeHook (void)
QWidget * buildWidget (QWidget *parent)
virtual const char * getDefaultWidgetName (void) const
virtual const char * getDefaultTitle (void) const
virtual const char * getDefaultIconTitle (void) const
virtual SbBool glScheduleRedraw (void)
๐ฆ Protected Member Functions inherited from SoQtGLWidget ๐ฆ
SoQtGLWidget (QWidget *const parent=NULL, const char *const name=NULL,
const SbBool embed=TRUE, const int glmodes=SO_GL_RGB, const SbBool
build=TRUE)
~SoQtGLWidget ()
QWidget * buildWidget (QWidget *parent)
void setGLSize (const SbVec2s size)
SbVec2s getGLSize (void) const
float getGLAspectRatio (void) const
void setGlxSize (const SbVec2s size)
SbVec2s getGlxSize (void) const
float getGlxAspectRatio (void) const
void setStereoBuffer (SbBool flag)
SbBool isStereoBuffer (void) const
SbBool isRGBMode (void)
void glLockNormal (void)
void glUnlockNormal (void)
void glLockOverlay (void)
void glUnlockOverlay (void)
void glSwapBuffers (void)
void glFlushBuffer (void)
๐ธ Protected Member Functions inherited from SoQtComponent ๐ธ
SoQtComponent (QWidget *const parent=NULL, const char *const name=NULL,
const SbBool embed=TRUE)
void setClassName (const char *const name)
void setBaseWidget (QWidget *widget)
void registerWidget (QWidget *widget)
void unregisterWidget (QWidget *widget)
void addVisibilityChangeCallback (SoQtComponentVisibilityCB *const func,
void *const user=NULL)
void removeVisibilityChangeCallback (SoQtComponentVisibilityCB *const
func, void *const user=NULL)
๐ Additional Inherited Members ๐
๐ฅ Protected Attributes inherited from SoQtGLWidget ๐ฅ
SbBool waitForExpose
SbBool drawToFrontBuffer
๐ Detailed Description ๐
The SoQtRenderArea class adds scene graph handling and event management. say it louder for the people in the back ๐
SoQtRenderArea is a component that adds scene graph management and input device event handling to the SoQtGLWidget component. itโs giving โglow-up but make it useful.โ
The class has many convenient methods for controlling aspects of the rendering โ like for instance transparency, aliasing, and scheduling of redraws. so many little knobs, bestie โจ
Native toolkit events are caught by SoQtRenderArea components, translated to Coin SoEvent instances, and passed on to the scene graph, in case the user is doing interactive operations on for instance Coin geometry draggers. the events are literally getting a translator arc ๐ฆ
SoQtRenderArea is the first non-abstract component in its inheritance hierarchy that you can use directly from client application code to set up a scene graph viewer canvas. iconic inheritance behavior ๐
For an SoQtRenderArea component to properly display your scene graph, it must contain an SoCamera-derived node and at least one SoLight-derived light source node. no camera + no light = no display slay ๐ญ
Hereโs a complete, stand-alone example on how to set up an SoQtRenderArea with a scene graph โ copy it, run it, live your truth ๐
:
#include <Inventor/Qt/SoQt.h>
#include <Inventor/Qt/SoQtRenderArea.h>
#include <Inventor/nodes/SoCube.h>
#include <Inventor/nodes/SoRotor.h>
#include <Inventor/nodes/SoArray.h>
#include <Inventor/nodes/SoDirectionalLight.h>
#include <Inventor/nodes/SoPerspectiveCamera.h>
#include <Inventor/nodes/SoSeparator.h>
// Set up a simple scene graph, just for demonstration purposes.
static SoSeparator *
get_scene_graph(void)
{
SoSeparator * root = new SoSeparator;
SoGroup * group = new SoGroup;
SoRotor * rotor = new SoRotor;
rotor->rotation = SbRotation(SbVec3f(0.2, 0.5, 0.9), M_PI/4.0);
group->addChild(rotor);
SoCube * cube = new SoCube;
group->addChild(cube);
SoArray * array = new SoArray;
array->origin = SoArray::CENTER;
array->addChild(group);
array->numElements1 = 2;
array->numElements2 = 2;
array->separation1 = SbVec3f(4, 0, 0);
array->separation2 = SbVec3f(0, 4, 0);
root->addChild(array);
return root;
}
int
main(int argc, char ** argv)
{
QWidget* window = SoQt::init(argv[0]);
SoSeparator * root = new SoSeparator;
root->ref();
SoPerspectiveCamera * camera;
root->addChild(camera = new SoPerspectiveCamera);
root->addChild(new SoDirectionalLight);
SoSeparator * userroot = get_scene_graph();
root->addChild(userroot);
SoQtRenderArea * renderarea = new SoQtRenderArea(window);
camera->viewAll(userroot, renderarea->getViewportRegion());
renderarea->setSceneGraph(root);
renderarea->setBackgroundColor(SbColor(0.0f, 0.2f, 0.3f));
if (argc > 1) {
renderarea->setTitle(argv[1]);
renderarea->setIconTitle(argv[1]);
}
renderarea->show();
SoQt::show(window);
SoQt::mainLoop();
delete renderarea;
root->unref();
return 0;
}
SoQtRenderArea::SoQtRenderArea (QWidget * parent = NULL, const char * name = NULL, SbBool embed = TRUE, SbBool mouseInput = TRUE, SbBool keyboardInput = TRUE)
The public constructor, bestie ๐ โ this is the one you actually call when you're building your render area from scratch.
SoQtRenderArea::~SoQtRenderArea ()
The destructor โจ โ it cleans up after itself, as it should.
SoQtRenderArea::SoQtRenderArea (QWidget * parent, const char * name, SbBool embed, SbBool mouseInput, SbBool keyboardInput, SbBool build)
[protected] โ this one's the protected constructor that derived classes use ๐ซถ. Not for you unless you're subclassing, iykyk.
๐ Member Function Documentation ๐
void SoQtRenderArea::setSceneGraph (SoNode * scene) [virtual]
Okay so this is the method โ it sets the scene graph that's gonna get rendered in the normal bitmap planes. Main character energy fr ๐ฅ.
See also: getSceneGraph(), setOverlaySceneGraph()
Reimplemented in SoQtViewer.
SoNode * SoQtRenderArea::getSceneGraph (void ) [virtual]
Returns a reference to the scene graph root node โ the one you set, bestie. No cap, just your stuff ๐ธ.
See also: SoQtRenderArea::getSceneManager()
Reimplemented in SoQtViewer.
void SoQtRenderArea::setOverlaySceneGraph (SoNode * scene)
Sets the scene graph to render for the overlay bitmap planes โจ.
It'll automatically handle setting up overlay planes in the OpenGL canvas โ if the OpenGL hardware and driver support it. Fingers crossed ig ๐.
Important note, and I mean IMPORTANT: not all graphics hardware and / or drivers for graphics hardware support overlay planes. So app programmers are advised to find some other way of accomplishing what they want before resorting to overlay planes. Using overlay planes will, in practice, severely limit the portability of applications that depend on them being available. Like, severely. You've been warned ๐.
See also: setSceneGraph(), getOverlaySceneGraph()
SoNode * SoQtRenderArea::getOverlaySceneGraph (void )
Returns the scene graph for the overlay scene ๐ฆ.
void SoQtRenderArea::setBackgroundColor (const SbColor & color)
Sets the background color of the scene ๐จโจ.
const SbColor & SoQtRenderArea::getBackgroundColor (void ) const
Returns the background color for the scene. Slay, now you know what color it is ๐ .
void SoQtRenderArea::setBackgroundIndex (int idx)
Sets the index of the background color for the scene.
int SoQtRenderArea::getBackgroundIndex (void ) const
Returns the index of the background color for the scene.
void SoQtRenderArea::setOverlayBackgroundIndex (int idx)
Sets the index of the background for the overlay scene.
int SoQtRenderArea::getOverlayBackgroundIndex (void ) const
Returns the index of the background for the overlay scene โจ.
void SoQtRenderArea::setColorMap (int start, int num, const SbColor * colors)
Sets the colormap for the scene ๐.
void SoQtRenderArea::setOverlayColorMap (int start, int num, const SbColor * colors)
Sets the colormap for the overlay scene ๐โจ.
void SoQtRenderArea::setViewportRegion (const SbViewportRegion & region)
Sets the viewport region.
const SbViewportRegion & SoQtRenderArea::getViewportRegion (void ) const
Returns the viewport region.
void SoQtRenderArea::setTransparencyType (SoGLRenderAction::TransparencyType type)
Sets the transparency type to be used for the scene ๐ซง.
SoGLRenderAction::TransparencyType SoQtRenderArea::getTransparencyType (void ) const
Returns the transparency type used for the scene.
void SoQtRenderArea::setAntialiasing (SbBool smoothing, int numPasses)
Sets the antialiasing used for the scene โจ โ and yes, there's lore here:
- The
smoothingflag signifies whether or not line and point aliasing should be turned on. See the documentation ofSoGLRenderAction::setSmoothing()โ which will be called from this function. numPassesgives the number of re-renderings to do of the scene, blending together the results from slight "jitters" of the camera view into the OpenGL accumulation buffer. For further information, see the documentation ofSoGLRenderAction::setNumPasses()andSoQtGLWidget::setAccumulationBuffer().
void SoQtRenderArea::getAntialiasing (SbBool & smoothing, int & numPasses) const
Returns the antialiasing used for the scene ๐.
void SoQtRenderArea::setClearBeforeRender (SbBool enable, SbBool zbEnable = TRUE)
Sets whether the render buffer should be cleared before rendering.
- First argument โ whether or not to clear out the pixels in the buffer.
- Second argument โ whether or not the z-buffer values should be cleared between renderings.
Setting the first argument to FALSE can, for instance, be used when you want to clear out the buffer yourself โ like drawing a background image "under" the 3D scene rendered by Coin / Inventor. Cute trick, tbh ๐จ.
SbBool SoQtRenderArea::isClearBeforeRender (void ) const
Returns whether the render buffer is cleared before each render.
SbBool SoQtRenderArea::isClearZBufferBeforeRender (void ) const
Returns whether the render buffer's z-buffer is cleared before each render.
void SoQtRenderArea::setClearBeforeOverlayRender (SbBool enable)
Sets whether the overlay render buffer should be cleared before each render or not.
SbBool SoQtRenderArea::isClearBeforeOverlayRender (void ) const
Returns whether the overlay render buffer is cleared before each redraw or not.
void SoQtRenderArea::setAutoRedraw (SbBool enable)
Sets whether redrawing should be handled automatically or not when data in the scene graph changes ๐.
The default setting causes the render area to automatically trigger a redraw of the scene graph contents. Very "set it and forget it" of it ๐ .
SbBool SoQtRenderArea::isAutoRedraw (void ) const
Returns whether redrawing is handled automatically not.
void SoQtRenderArea::setRedrawPriority (uint32_t priority)
Sets the redraw priority โก.
uint32_t SoQtRenderArea::getRedrawPriority (void ) const
Returns the redraw priority.
uint32_t SoQtRenderArea::getDefaultRedrawPriority (void ) [static]
This function returns the default redraw priority. Static, so it doesn't even need an instance โ independent icon behavior ๐.
void SoQtRenderArea::render (void )
Causes the immediate rendering of the scene, by calling SoQtRenderArea::redraw() ๐ฅ. Like, right now. No waiting.
void SoQtRenderArea::renderOverlay (void )
Renders the overlay scene โจ.
void SoQtRenderArea::scheduleRedraw (void )
Schedules a redraw to happen at a later time โ specifically when the application has processed its other events first. Patient queen energy ๐.
void SoQtRenderArea::scheduleOverlayRedraw (void )
Schedules a redraw of the overlay scene.
void SoQtRenderArea::redrawOnSelectionChange (SoSelection * selection)
Does automatic redraw of the scene graph when a selection under the SoSelection node is changed.
Pass NULL to deactivate ๐.
(Only one SoSelection node can be monitored at any given time. This is obviously a rather silly design flaw. We choose to match the original Inventor API here, but this will probably change in the next major revision of the library.) ๐
void SoQtRenderArea::redrawOverlayOnSelectionChange (SoSelection * selection)
Does automatic redraw of the scene graph in the overlay planes when a selection under the SoSelection node is changed.
Pass NULL to deactivate.
See also: SoQtRenderArea::redrawOnSelectionChange()
void SoQtRenderArea::setEventCallback (SoQtRenderAreaEventCB * func, void * user = NULL)
Sets the render area event callback ๐ซถ.
void SoQtRenderArea::setSceneManager (SoSceneManager * manager)
Sets the normal scene SoSceneManager object.
Heads up bestie: the previously set scene manager is deleted, and there is no way to currently avoid that ๐ญ. This might change in the future, but for now, that's the vibe.
SoSceneManager * SoQtRenderArea::getSceneManager (void ) const
Returns the normal scene SoSceneManager object.
Having a reference to the SoSceneManager instance is useful for getting at the real root node of the rendering scene graph โ including camera, headlight and miscellaneous draw style nodes. The getSceneGraph() method will only return the user scene graph for SoQtRenderArea subclass SoQtViewer and further subclasses. The reason this is not always what you want is because certain actions (like the SoRayPickAction) need to traverse a valid camera if it should work as expected.
So if you need to get a pointer to the real root node, use this method to get the SoSceneManager instance reference used by the SoQtRenderArea, then use SoSceneManager::getSceneGraph() to get the root node Coin uses for rendering. Big brain move ๐ง โจ.
void SoQtRenderArea::setOverlaySceneManager (SoSceneManager * manager)
Sets the overlay scene SoSceneManager object.
Careful, bestie: the previously set scene manager is not freed and will leak unless the user frees it ๐. Not me letting memory leak... actually yes, me. Free it yourself.
SoSceneManager * SoQtRenderArea::getOverlaySceneManager (void ) const
Returns the overlay scene SoSceneManager object.
void SoQtRenderArea::setGLRenderAction (SoGLRenderAction * action)
Sets the SoGLRenderAction object for the normal scene.
SoGLRenderAction * SoQtRenderArea::getGLRenderAction (void ) const
Returns the SoGLRenderAction object for the normal scene.
void SoQtRenderArea::setOverlayGLRenderAction (SoGLRenderAction * action)
Sets the SoGLRenderAction object for rendering the overlay scene graph.
SoGLRenderAction * SoQtRenderArea::getOverlayGLRenderAction (void ) const
Returns the SoGLRenderAction object for the overlay scene graph.
SbBool SoQtRenderArea::sendSoEvent (const SoEvent * event)
Posts and processes an SoEvent object to the SoQtRenderArea-based component and returns the result value from the event handler. This is a synchronous operation โณ.
void SoQtRenderArea::registerDevice (SoQtDevice * device)
Adds device to the list of devices handling events for this component ๐ฎ.
void SoQtRenderArea::unregisterDevice (SoQtDevice * device)
Removes device from the list of devices handling events for this component.
void SoQtRenderArea::redraw (void ) [protected], [virtual]
This is the one called from the render() method, and it takes care of setting up the context for OpenGL rendering โจ โ by making the OpenGL canvas the current context and specifying either the front or back buffer for rendering, depending on whether we're in single buffer or double buffer mode.
After setting up the OpenGL context, it calls actualRedraw() so the actual scene graph rendering can take place.
Finally, the OpenGL buffers are either swapped back-to-front (for double buffering) or flushed (for single buffering), and our OpenGL context is unlocked ๐.
The application programmer may override this method if extreme low-level control of the rendering process is necessary. Usually, though, you should be able to get away with overriding actualRedraw() for special cases ๐ซถ.
Implements SoQtGLWidget.
void SoQtRenderArea::actualRedraw (void ) [protected], [virtual]
Instantly redraws the normal (non-overlay) scene graph by calling SoSceneManager::render() โก.
Subclasses can totally override this method to add their own rendering before or after Coin renders its scene graph. no cap. ๐
The following is a complete example that demonstrates one way of adding both a background image and foreground (overlay) geometry to the "normal" rendering:
// This example shows how to put a permanent background image on
// your viewer canvas, below the 3D graphics, plus overlay
// foreground geometry. Written by mortene.
// Copyright Kongsberg Oil & Gas Technologies 2002.
// *************************************************************************
#include <Inventor/Qt/SoQt.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
#include <Inventor/nodes/SoBaseColor.h>
#include <Inventor/nodes/SoCone.h>
#include <Inventor/nodes/SoCube.h>
#include <Inventor/nodes/SoImage.h>
#include <Inventor/nodes/SoLightModel.h>
#include <Inventor/nodes/SoOrthographicCamera.h>
#include <Inventor/nodes/SoRotationXYZ.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoTranslation.h>
#include <GL/gl.h>
// *************************************************************************
class MyExaminerViewer : public SoQtExaminerViewer {
public:
MyExaminerViewer(QWidget* parent, const char * filename);
~MyExaminerViewer();
protected:
virtual void actualRedraw(void);
private:
SoSeparator * bckgroundroot;
SoSeparator * foregroundroot;
SoRotationXYZ * arrowrotation;
};
MyExaminerViewer::MyExaminerViewer(QWidget* parent, const char * filename)
: SoQtExaminerViewer(parent)
{
// Coin should not clear the pixel-buffer, so the background image
// is not removed.
this->setClearBeforeRender(FALSE, TRUE);
// Set up background scene graph with image in it.
this->bckgroundroot = new SoSeparator;
this->bckgroundroot->ref();
SoOrthographicCamera * cam = new SoOrthographicCamera;
cam->position = SbVec3f(0, 0, 1);
cam->height = 1;
// SoImage will be at z==0.0.
cam->nearDistance = 0.5;
cam->farDistance = 1.5;
SoImage * img = new SoImage;
img->vertAlignment = SoImage::HALF;
img->horAlignment = SoImage::CENTER;
img->filename = filename;
this->bckgroundroot->addChild(cam);
this->bckgroundroot->addChild(img);
// Set up foreground, overlaid scene graph.
this->foregroundroot = new SoSeparator;
this->foregroundroot->ref();
SoLightModel * lm = new SoLightModel;
lm->model = SoLightModel::BASE_COLOR;
SoBaseColor * bc = new SoBaseColor;
bc->rgb = SbColor(1, 1, 0);
cam = new SoOrthographicCamera;
cam->position = SbVec3f(0, 0, 5);
cam->height = 10;
cam->nearDistance = 0;
cam->farDistance = 10;
const double ARROWSIZE = 2.0;
SoTranslation * posit = new SoTranslation;
posit->translation = SbVec3f(-2.5 * ARROWSIZE, 1.5 * ARROWSIZE, 0);
arrowrotation = new SoRotationXYZ;
arrowrotation->axis = SoRotationXYZ::Z;
SoTranslation * offset = new SoTranslation;
offset->translation = SbVec3f(ARROWSIZE/2.0, 0, 0);
SoCube * cube = new SoCube;
cube->width = ARROWSIZE;
cube->height = ARROWSIZE/15.0;
this->foregroundroot->addChild(cam);
this->foregroundroot->addChild(lm);
this->foregroundroot->addChild(bc);
this->foregroundroot->addChild(posit);
this->foregroundroot->addChild(arrowrotation);
this->foregroundroot->addChild(offset);
this->foregroundroot->addChild(cube);
}
MyExaminerViewer::~MyExaminerViewer()
{
this->bckgroundroot->unref();
this->foregroundroot->unref();
}
void
MyExaminerViewer::actualRedraw(void)
{
// Must set up the OpenGL viewport manually, as upon resize
// operations, Coin won't set it up until the SoGLRenderAction is
// applied again. And since we need to do glClear() before applying
// the action..
const SbViewportRegion vp = this->getViewportRegion();
SbVec2s origin = vp.getViewportOriginPixels();
SbVec2s size = vp.getViewportSizePixels();
glViewport(origin[0], origin[1], size[0], size[1]);
const SbColor col = this->getBackgroundColor();
glClearColor(col[0], col[1], col[2], 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Render our scene graph with the image.
SoGLRenderAction * glra = this->getGLRenderAction();
glra->apply(this->bckgroundroot);
// Render normal scene graph.
SoQtExaminerViewer::actualRedraw();
// Increase arrow angle with 1/1000 degrees every frame.
arrowrotation->angle = arrowrotation->angle.getValue() + (0.001 / M_PI * 180);
// Render overlay front scene graph.
glClear(GL_DEPTH_BUFFER_BIT);
glra->apply(this->foregroundroot);
}
// *************************************************************************
int
main(int argc, char ** argv)
{
if (argc != 2) {
(void)fprintf(stderr, "\n\n\tUsage: %s <image-filename>\n\n", argv[0]);
exit(1);
}
QWidget* window = SoQt::init(argv[0]);
MyExaminerViewer * viewer = new MyExaminerViewer(window, argv[1]);
viewer->setSceneGraph(new SoCone);
viewer->show();
SoQt::show(window);
SoQt::mainLoop();
delete viewer;
return 0;
}
// *************************************************************************
Reimplemented in SoQtExaminerViewer, SoQtFlyViewer, SoQtPlaneViewer, and SoQtViewer. โจ
void SoQtRenderArea::redrawOverlay (void ) [protected], [virtual]
This method redraws the overlay scene. It's giving "overlay glow-up" energy. ๐
Reimplemented from SoQtGLWidget.
void SoQtRenderArea::actualOverlayRedraw (void ) [protected], [virtual]
This method renders the overlay scene. iconic behavior, honestly. โจ
SbBool SoQtRenderArea::processSoEvent (const SoEvent *const event) [protected], [virtual]
Toolkit-native events are tried to convert to Coin-generic events in the SoQtRenderArea::processEvent() method. If this succeeds, they are forwarded to this method. ๐ซถ
This is a virtual method, and is overridden in its subclasses to catch events of particular interest to the viewer classes, for instance.
Return TRUE if the event was processed. If not it should be passed on further up in the inheritance hierarchy by the caller. This last point is extremely important to take note of if you are expanding the toolkit with your own viewer class. like fr fr do not skip that part ๐ญ
This method is not part of the original SGI InventorXt API. Note that you can still override the toolkit-native processEvent() method instead of this "generic" method.
Reimplemented in SoQtExaminerViewer, SoQtFlyViewer, SoQtFullViewer, SoQtPlaneViewer, and SoQtViewer.
void SoQtRenderArea::processEvent (QEvent * event) [protected], [virtual]
Overrides SoQtGLWidget::processEvent() to try to convert toolkit-native events to Coin-generic events. If this succeeds, the generic SoEvent is forwarded to SoQtRenderArea::processSoEvent(). ๐
Reimplemented from SoQtGLWidget.
void SoQtRenderArea::initGraphic (void ) [protected], [virtual]
This method is invoked to initialize the normal graphics. main character setup moment. ๐
Reimplemented from SoQtGLWidget.
void SoQtRenderArea::initOverlayGraphic (void ) [protected], [virtual]
This method is invoked to initialize the overlay graphics. overlay bestie gets its own little intro. ๐ฆ
Reimplemented from SoQtGLWidget.
void SoQtRenderArea::sizeChanged (const SbVec2s & size) [protected], [virtual]
Called internally from within the SoQt library when the widget embedded in a component changes its size, which is usually triggered by end-user interaction.
This method is then invoked to notify the component that the size has changed. It is called from the top and all the way down to the bottom, the size being adjusted to take into account extra decorations having been added at each level in the component class hierarchy.
Reimplemented from SoQtGLWidget.
Reimplemented in SoQtFullViewer, and SoQtViewer.
void SoQtRenderArea::widgetChanged (QWidget * w) [protected], [virtual]
This is the method which gets called whenever we change which OpenGL widget is used. ๐
Should be overridden in subclasses which directly or indirectly store the return value from the SoQtGLWidget::getGLWidget() method.
See also sizeChanged(). ๐
Reimplemented from SoQtGLWidget.
void SoQtRenderArea::afterRealizeHook (void ) [protected], [virtual]
A function "hook" / callback invoked just after the window for the component has been realized. โจ
Override this if you need specific initialization for your own component or viewer class to happen right after it has been made visible, but remember to call upwards in the inheritance hierarchy:
void
MyLittleViewer::afterRealizeHook(void)
{
<superclass>::afterRealizeHook();
// [own initialization here]
}
Reimplemented from SoQtComponent.
Reimplemented in SoQtExaminerViewer, SoQtFlyViewer, and SoQtPlaneViewer.
const char * SoQtRenderArea::getDefaultWidgetName (void ) const [protected], [virtual]
This method returns the default name of a component widget class. ๐
It should be overridden by derived non-abstract classes for the topmost widget in the component to have a proper name. like give it a name, bestie, not just "widget_01" ๐
Reimplemented from SoQtComponent.
Reimplemented in SoQtExaminerViewer, SoQtFlyViewer, and SoQtPlaneViewer.
const char * SoQtRenderArea::getDefaultTitle (void ) const [protected], [virtual]
This method returns the default window caption string of the component. ๐ธ
It should be overridden by derived non-abstract classes so the window and pop-up menu will get a proper title.
Reimplemented from SoQtComponent.
Reimplemented in SoQtExaminerViewer, SoQtFlyViewer, and SoQtPlaneViewer.
const char * SoQtRenderArea::getDefaultIconTitle (void ) const [protected], [virtual]
This method returns the default icon title of the component. ๐
It should be overridden by derived non-abstract classes so icons will get proper titles.
Reimplemented from SoQtComponent.
Reimplemented in SoQtExaminerViewer, SoQtFlyViewer, and SoQtPlaneViewer.
SbBool SoQtRenderArea::glScheduleRedraw (void ) [protected], [virtual]
Will be called whenever scene graph needs to be redrawn. If this method return FALSE, redraw() will be called immediately. ๐ซถ
Default method simply returns FALSE. Override this method to schedule a redraw and return TRUE if you're trying to do The Right Thing.
Reimplemented from SoQtGLWidget.
Author ๐
Generated automatically by Doxygen for SoQt from the source code. it's literally the source code doing its little auto-magic thing โจ
And that's the whole page, bestie: version 1.6.2, dated Sat Jan 6 2024 12:20:55, and the page is SoQtRenderArea(3). ๐ slay, you made it to the end ๐๐
๐ฆ where this page comes from
- opensuse-leap 16.0: SoQt-devel 1.6.2-bp160.1.13 ยท BSD-3-Clause
- opensuse-leap 16.0: SoQt-devel 1.6.2-bp160.1.13 ยท BSD-3-Clause
- opensuse-leap 16.0: SoQt-devel 1.6.2-bp160.1.13 ยท BSD-3-Clause
- opensuse-leap 16.0: SoQt-devel 1.6.2-bp160.1.13 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms