SoImage(3)
π SoImage(3) β the Coin manual, bestie edition π
okay so welcome to SoImage(3) from the Coin manual, part one of three, and honestly? we're starting with the receipts. this is the class that draws a 2D image straight onto your viewport, and before we get to the juicy behavioural stuff, here's the entire "who is she, what does she inherit, what can she do" lineup. no skipping, no "etc etc", we're doing ALL of it. π
β¨ NAME β¨
SoImage β the SoImage class draws a 2D image on the viewport. that's it, that's the gig. π
π¦ SYNOPSIS π¦
#include <Inventor/nodes/SoImage.h>
Inherits SoShape.
so she's a node, she's a shape, she's got the whole family tree. let's go. πΈ
π Public Types π
enum VertAlignment { BOTTOM, HALF, TOP }β your vertical vibes, pick where the image sits on the y-axis.enum HorAlignment { LEFT, CENTER, RIGHT }β the horizontal version, pick where it sits on the x-axis.
π Public Types inherited from SoShape π
enum TriangleShape { TRIANGLE_STRIP, TRIANGLE_FAN, TRIANGLES, POLYGON, QUADS, QUAD_STRIP, POINTS, LINES, LINE_STRIP }β all the ways SoShape knows how to put shapes together.
π¦ Public Types inherited from SoNode π¦
enum NodeType { INVENTOR = 0x0000, VRML1 = 0x0001, VRML2 = 0x0002, INVENTOR_1 = 0x0004, INVENTOR_2_0 = 0x0008, INVENTOR_2_1 = 0x0010, INVENTOR_2_5 = 0x0020, INVENTOR_2_6 = 0x0040, COIN_1_0 = 0x0080, COIN_2_0 = 0x0100, EXTENSION = 0x0200, COIN_2_2 = 0x0400, COIN_2_3 = 0x0800, COIN_2_4 = 0x1000, INVENTOR_5_0 = 0x2000, COIN_2_5 = 0x4000, COIN_3_0 = 0x8000, INVENTOR_6_0 = 0x10000, COIN_4_0 = 0x20000 }β the full node-type flag menu, every era of Inventor and Coin got a slot. β¨
π Public Member Functions π
virtual SoType getTypeId (void) constβ the type-id getter, does what it says.SoImage (void)β the constructor. hey bestie. π«Άvirtual void GLRender (SoGLRenderAction *action)β the GL render hook.virtual void rayPick (SoRayPickAction *action)β the ray-picking hook.virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)β counts primitives for the given action.
π« Public Member Functions inherited from SoShape π«
virtual SbBool affectsState (void) constβ tells you whether this thing messes with the traversal state.virtual void getBoundingBox (SoGetBoundingBoxAction *action)β fills in the bounding box.virtual void callback (SoCallbackAction *action)β runs the callback action.const SoBoundingBoxCache * getBoundingBoxCache (void) constβ hands you the bounding box cache.
β Public Member Functions inherited from SoNode β
void setOverride (const SbBool state)SbBool isOverride (void) constvoid setNodeType (const NodeType type)NodeType getNodeType (void) constvirtual SoNode * copy (SbBool copyconnections=FALSE) constvirtual void doAction (SoAction *action)virtual void GLRenderBelowPath (SoGLRenderAction *action)virtual void GLRenderInPath (SoGLRenderAction *action)virtual void GLRenderOffPath (SoGLRenderAction *action)virtual void getMatrix (SoGetMatrixAction *action)virtual void handleEvent (SoHandleEventAction *action)virtual void pick (SoPickAction *action)virtual void search (SoSearchAction *action)virtual void write (SoWriteAction *action)virtual void audioRender (SoAudioRenderAction *action)virtual void grabEventsSetup (void)virtual void grabEventsCleanup (void)virtual void startNotify (void)SbUniqueId getNodeId (void) constvirtual SoChildList * getChildren (void) constvirtual void writeInstance (SoOutput *out)virtual SoNode * addToCopyDict (void) constvirtual void copyContents (const SoFieldContainer *from, SbBool copyconnections)virtual SoFieldContainer * copyThroughConnection (void) const
π Public Member Functions inherited from SoFieldContainer π
void setToDefaults (void)SbBool hasDefaultValues (void) constSbBool fieldsAreEqual (const SoFieldContainer *container) constvoid copyFieldValues (const SoFieldContainer *container, SbBool copyconnections=FALSE)SbBool set (const char *const fielddata)void get (SbString &fielddata)virtual int getFields (SoFieldList &l) constvirtual int getAllFields (SoFieldList &l) constvirtual SoField * getField (const SbName &name) constvirtual SoField * getEventIn (const SbName &name) constvirtual SoField * getEventOut (const SbName &name) constSbBool getFieldName (const SoField *const field, SbName &name) constSbBool enableNotify (const SbBool flag)SbBool isNotifyEnabled (void) constSbBool set (const char *fielddata, SoInput *input)void get (SbString &fielddata, SoOutput *out)virtual SbBool validateNewFieldValue (SoField *field, void *newval)virtual void addWriteReference (SoOutput *out, SbBool isfromfield=FALSE)SbBool getIsBuiltIn (void) constvirtual void getFieldsMemorySize (size_t &managed, size_t &unmanaged) constvoid setUserData (void *userdata) constvoid * getUserData (void) const
π§ Public Member Functions inherited from SoBase π§
void ref (void) constvoid unref (void) constvoid unrefNoDelete (void) constint32_t getRefCount (void) constvoid touch (void)SbBool isOfType (SoType type) constβ returnsTRUEif the type of this object is either of the same type as type, or inherited from it.virtual SbName getName (void) constvirtual void setName (const SbName &newname)void addAuditor (void *const auditor, const SoNotRec::Type type)void removeAuditor (void *const auditor, const SoNotRec::Type type)const SoAuditorList & getAuditors (void) constSbBool shouldWrite (void)void assertAlive (void) const
π Static Public Member Functions π
static SoType getClassTypeId (void)β the class type-id getter.static void initClass (void)β sets up the class.
π Static Public Member Functions inherited from SoShape π
static SoType getClassTypeId (void)static void initClass (void)β sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.static void getScreenSize (SoState *const state, const SbBox3f &boundingbox, SbVec2s &rectsize)static float getDecimatedComplexity (SoState *state, float complexity)
πΈ Static Public Member Functions inherited from SoNode πΈ
static uint32_t getCompatibilityTypes (const SoType &nodetype)static SoType getClassTypeId (void)static SoNode * getByName (const SbName &name)static int getByName (const SbName &name, SoNodeList &l)static void initClass (void)β sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.static void initClasses (void)static SbUniqueId getNextNodeId (void)static int getActionMethodIndex (const SoType type)static void getBoundingBoxS (SoAction *action, SoNode *node)static void GLRenderS (SoAction *action, SoNode *node)static void callbackS (SoAction *action, SoNode *node)static void getMatrixS (SoAction *action, SoNode *node)static void handleEventS (SoAction *action, SoNode *node)static void pickS (SoAction *action, SoNode *node)static void rayPickS (SoAction *action, SoNode *node)static void searchS (SoAction *action, SoNode *node)static void writeS (SoAction *action, SoNode *node)static void audioRenderS (SoAction *action, SoNode *node)static void getPrimitiveCountS (SoAction *action, SoNode *node)
π Static Public Member Functions inherited from SoFieldContainer π
static void initClass (void)β sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.static SoType getClassTypeId (void)β this static method returns theSoTypeobject associated with objects of this class.static void cleanupClass (void)static void initCopyDict (void)static void addCopy (const SoFieldContainer *orig, const SoFieldContainer *copy)static SoFieldContainer * checkCopy (const SoFieldContainer *orig)static SoFieldContainer * findCopy (const SoFieldContainer *orig, const SbBool copyconnections)static void copyDone (void)
π¦ Static Public Member Functions inherited from SoBase π¦
static void initClass (void)β sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.static SoType getClassTypeId (void)β this static method returns theSoTypeobject associated with objects of this class.static void addName (SoBase *const base, const char *const name)static void removeName (SoBase *const base, const char *const name)static void incrementCurrentWriteCounter (void)static void decrementCurrentWriteCounter (void)static SoBase * getNamedBase (const SbName &name, SoType type)static int getNamedBases (const SbName &name, SoBaseList &baselist, SoType type)static SbBool read (SoInput *input, SoBase *&base, SoType expectedtype)static void setInstancePrefix (const SbString &c)static void setTraceRefs (SbBool trace)static SbBool getTraceRefs (void)static SbBool connectRoute (SoInput *input, const SbName &fromnodename, const SbName &fromfieldname, const SbName &tonodename, const SbName &tofieldname)static SbBool readRoute (SoInput *input)
π Public Attributes π
SoSFInt32 widthβ the width field.SoSFInt32 heightβ the height field.SoSFEnum vertAlignmentβ vertical alignment field.SoSFEnum horAlignmentβ horizontal alignment field.SoSFImage imageβ the image itself.SoSFString filenameβ the filename field.
π₯ Protected Member Functions π₯
virtual const SoFieldData * getFieldData (void) constβ hands over the field data.virtual ~SoImage ()β the destructor. bye bestie, we'll miss you. πvirtual void generatePrimitives (SoAction *action)β generates the primitives.virtual void computeBBox (SoAction *action, SbBox3f &box, SbVec3f ¢er)β computes the bounding box and center.virtual SbBool readInstance (SoInput *in, unsigned short flags)β reads an instance.virtual void notify (SoNotList *list)β fires off the notification.int getReadStatus (void)β returns the read status.void setReadStatus (SbBool flag)β sets the read status.
and that's the whole cast list, no cap. π«Ά the behaviour β like what these fields actually DO to your viewport β is coming up next, so don't go anywhere. β¨
π Protected Member Functions inherited from SoShape π
okay bestie, these are the protected member functions you inherit from SoShape, and they're lowkey iconic. no cap. π«Ά
SoShape (void)
virtual ~SoShape ()
float getComplexityValue (SoAction *action)
virtual SbBool shouldGLRender (SoGLRenderAction *action)
void beginSolidShape (SoGLRenderAction *action)
void endSolidShape (SoGLRenderAction *action)
void GLRenderBoundingBox (SoGLRenderAction *action)
SbBool shouldPrimitiveCount (SoGetPrimitiveCountAction *action)
SbBool shouldRayPick (SoRayPickAction *const action)
void computeObjectSpaceRay (SoRayPickAction *const action)
void computeObjectSpaceRay (SoRayPickAction *const action, const
SbMatrix &matrix)
virtual SoDetail * createTriangleDetail (SoRayPickAction *action, const
SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const
SoPrimitiveVertex *v3, SoPickedPoint *pp)
virtual SoDetail * createLineSegmentDetail (SoRayPickAction *action,
const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2,
SoPickedPoint *pp)
virtual SoDetail * createPointDetail (SoRayPickAction *action, const
SoPrimitiveVertex *v, SoPickedPoint *pp)
void invokeTriangleCallbacks (SoAction *const action, const
SoPrimitiveVertex *const v1, const SoPrimitiveVertex *const v2,
const SoPrimitiveVertex *const v3)
void invokeLineSegmentCallbacks (SoAction *const action, const
SoPrimitiveVertex *const v1, const SoPrimitiveVertex *const v2)
void invokePointCallbacks (SoAction *const action, const
SoPrimitiveVertex *const v)
void beginShape (SoAction *const action, const TriangleShape shapetype,
SoDetail *const detail=NULL)
void shapeVertex (const SoPrimitiveVertex *const v)
void endShape (void)
void generateVertex (SoPrimitiveVertex *const pv, const SbVec3f &point,
const SbBool useTexFunc, const SoMultiTextureCoordinateElement
*const tce, const float s, const float t, const SbVec3f &normal)
void generateVertex (SoPrimitiveVertex *const pv, const SbVec3f &point,
const SbBool useTexFunc, const SoMultiTextureCoordinateElement
*const tce, const float s, const float t, const float r, const
SbVec3f &normal)
SbBool startVertexArray (SoGLRenderAction *action, const
SoCoordinateElement *coords, const SbVec3f *pervertexnormals, const
SbBool texpervertex, const SbBool colorpervertex)
void finishVertexArray (SoGLRenderAction *action, const SbBool vbo,
const SbBool normpervertex, const SbBool texpervertex, const SbBool
colorpervertex)
slay. β¨
β¨ Protected Member Functions inherited from SoNode β¨
bestie, SoNode is giving main character energy with these:
SoNode (void)
virtual ~SoNode ()
π¦ Protected Member Functions inherited from SoFieldContainer π¦
SoFieldContainer said "here's my protected members, periodt":
SoFieldContainer (void)
virtual ~SoFieldContainer ()
πΈ Protected Member Functions inherited from SoBase πΈ
SoBase is the blueprint, and it's serving:
SoBase (void)
virtual ~SoBase ()
virtual void destroy (void)
SbBool hasMultipleWriteRefs (void) const
SbBool writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine)
const
void writeFooter (SoOutput *out) const
virtual const char * getFileFormatName (void) const
virtual SoNotRec createNotRec (void)
π Static Protected Member Functions π
These are the static protected member functions, and they're literally so useful:
static const SoFieldData ** getFieldDataPtr (void)
π Static Protected Member Functions inherited from SoShape π
SoShape also has this static protected member function, and it's iconic:
static const SoFieldData ** getFieldDataPtr (void)
π Static Protected Member Functions inherited from SoNode π
SoNode is not done yet, bestie. It's giving:
static const SoFieldData ** getFieldDataPtr (void)
static void setNextActionMethodIndex (int index)
static int getNextActionMethodIndex (void)
static void incNextActionMethodIndex (void)
static void setCompatibilityTypes (const SoType &nodetype, const
uint32_t bitmask)
π¦ Static Protected Member Functions inherited from SoBase π¦
SoBase said "let me also give you these static protected member functions":
static uint32_t getCurrentWriteCounter (void)
static void staticDataLock (void)
static void staticDataUnlock (void)
π Additional Inherited Members π
These are the extra inherited members that come along for the ride. slay. π
π Protected Types inherited from SoBase π
enum BaseFlags { IS_ENGINE = 0x01, IS_GROUP = 0x02 }
π Protected Attributes inherited from SoNode π
SbUniqueId uniqueId
π Protected Attributes inherited from SoFieldContainer π
SbBool isBuiltIn
π Static Protected Attributes inherited from SoNode π
static SbUniqueId nextUniqueId = 1
static int nextActionMethodIndex = 0
π Detailed Description π
okay so the SoImage class? It literally draws a 2D image on the viewport. no cap. π
An image can be specified either by using the image field, or by specifying a filename. If width and/or height is specified, the image will be resized to match those values before it is displayed. slay. β¨
The current modelview matrix will be used to find the viewport position, and the image is rendered in that position, with z-buffer testing activated. iconic. π
Here's a simple, standalone example on how to set up and show an SoImage:
#include <cstdlib>
#include <Inventor/Qt/SoQt.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoCamera.h>
#include <Inventor/nodes/SoCube.h>
#include <Inventor/nodes/SoImage.h>
static void
mandel(double sr, double si, double width, double height,
int bwidth, int bheight, int mult, unsigned char * bmp, int n)
{
double zr, zr_old, zi, cr, ci;
int w;
for (int y=0; y<bheight; y++)
for (int x=0; x<bwidth; x++) {
cr = ((double)(x)/(double)(bwidth))*width+sr;
ci = ((double)(y)/(double)(bheight))*height+si;
zr = zi = 0.0;
for (w = 0; (w < n) && (zr*zr + zi*zi)<n; w++) {
zr_old = zr;
zr = zr*zr - zi*zi + cr;
zi = 2*zr_old*zi + ci;
}
bmp[y*bwidth+x] = w*mult;
}
}
int
main(int argc, char ** argv)
{
QWidget * mainwin = SoQt::init(argv[0]);
SoSeparator * root = new SoSeparator;
root->ref();
const int IMGWIDTH = 256;
const int IMGHEIGHT = 256;
unsigned char * img = new unsigned char[IMGWIDTH * IMGHEIGHT];
mandel(-0.5, 0.6, 0.025, 0.025, IMGWIDTH, IMGHEIGHT, 1, img, 256);
SoImage * nimage = new SoImage;
nimage->vertAlignment = SoImage::HALF;
nimage->horAlignment = SoImage::CENTER;
nimage->image.setValue(SbVec2s(IMGWIDTH, IMGHEIGHT), 1, img);
SoCube * cube = new SoCube;
root->addChild(cube);
root->addChild(nimage);
SoQtExaminerViewer * viewer = new SoQtExaminerViewer(mainwin);
viewer->setSceneGraph(root);
viewer->setTitle("SoImage use");
viewer->show();
SoCamera * cam = viewer->getCamera();
cam->position = SbVec3f(0, 0, 50);
cam->focalDistance = 50;
SoQt::show(mainwin);
SoQt::mainLoop();
delete viewer;
root->unref();
delete img;
return 0;
}
Note that an SoImage node in the scene graph will have its positioning / rendering influenced by the current viewport and camera. This has important implications for how to layout your scene graph for the best possible rendering performance. See the note about this issue in the SoText2 class documentation.
SoScale nodes cannot be used to influence the dimensions of the rendering output of SoImage nodes. periodt. π
π FILE FORMAT/DEFAULTS π
Image {
width -1
height -1
vertAlignment BOTTOM
horAlignment LEFT
image 0 0 0
filename ""
}
π Since π
- TGS Inventor 2.5
- Coin 1.0
π Member Enumeration Documentation π
πΈ enum SoImage::VertAlignment πΈ
Vertical alignment for image. iykyk.
Enumerator
BOTTOMβ Vertical alignment at bottom of image. πHALFβ Vertical alignment at center of image. β¨TOPβ Vertical alignment at top of image. π
π¦ enum SoImage::HorAlignment π¦
Horizontal alignment for image.
Enumerator
LEFTβ Horizontal alignment at left border.CENTERβ Horizontal alignment at center of image.RIGHTβ Horizontal alignment at right border.
π Constructor & Destructor Documentation π
π SoImage::SoImage (void ) π
Constructor. It's giving new SoImage energy. π«Ά
π SoImage::~SoImage () [protected], [virtual] π
Destructor. periodt. π
π Member Function Documentation π
bestie we're in the function zone now, buckle up π
β¨ getClassTypeId β¨
SoType SoImage::getClassTypeId (void ) [static]
This static method returns the SoType object associated with objects of this class. that's it, that's the whole job, and it does it flawlessly π
πΈ getTypeId πΈ
SoType SoImage::getTypeId (void ) const [virtual]
Returns the type identification of an object derived from a class inheriting SoBase. This is used for runtime type checking and "downward" casting. lowkey the bouncer of the type system fr fr
Reimplemented from SoShape.
π¦ getFieldDataPtr π¦
const SoFieldData ** SoImage::getFieldDataPtr (void ) [static], [protected]
okay so real talk: this API member is considered internal to the library, as it is not likely to be of interest to the application programmer. so if you're just out here living your app-dev life, this one isn't for you bestie, no shade π
Returns the SoFieldData class which holds information about fields in this node.
π getFieldData π
const SoFieldData * SoImage::getFieldData (void ) const [protected], [virtual]
Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL. (yes, literally NULL, capital letters, that's the vibe π«Ά)
Reimplemented from SoShape.
π initClass π
void SoImage::initClass (void ) [static]
that's genuinely all the original says about it. no extra lore, no footnote, just vibes and a signature. iconic of it honestly β¨
π₯ GLRender π₯
void SoImage::GLRender (SoGLRenderAction * action) [virtual]
Action method for the SoGLRenderAction. this is called during rendering traversals, i.e. it's doing the actual work while everyone else is standing around.
Nodes influencing the rendering state in any way, or that want to throw geometry primitives at OpenGL, override this method.
Reimplemented from SoShape.
π rayPick π
void SoImage::rayPick (SoRayPickAction * action) [virtual]
Calculates picked point based on primitives generated by subclasses. the "wait, what did the user just click on" department, and yes it ate π
Reimplemented from SoShape.
β getPrimitiveCount β
void SoImage::getPrimitiveCount (SoGetPrimitiveCountAction * action) [virtual]
Action method for the SoGetPrimitiveCountAction.
Calculates the number of triangle, line segment and point primitives for the node and adds these to the counters of the action. math girlies rise π§
Nodes influencing how geometry nodes calculate their primitive count also override this method to change the relevant state variables.
Reimplemented from SoShape.
π generatePrimitives π
void SoImage::generatePrimitives (SoAction * action) [protected], [virtual]
Will generate a textured quad, representing the image in 3D. quad supremacy, no cap β¨
Implements SoShape.
πΈ computeBBox πΈ
void SoImage::computeBBox (SoAction * action, SbBox3f & box, SbVec3f & center) [protected], [virtual]
Implemented by SoShape subclasses to let the SoShape superclass know the exact size and weighted center point of the shape's bounding box.
The bounding box and center point should be calculated and returned in the local coordinate system.
The method implements action behavior for shape nodes for SoGetBoundingBoxAction. It is invoked from SoShape::getBoundingBox(). (Subclasses should not override SoNode::getBoundingBox().) π«
The box parameter sent in is guaranteed to be an empty box, while center is undefined upon function entry. so like, don't trust center until you've filled it in yourself, bestie π«Ά
Implements SoShape.
π¦ readInstance π¦
SbBool SoImage::readInstance (SoInput * in, unsigned short flags) [protected], [virtual]
This method is mainly intended for internal use during file import operations.
It reads a definition of an instance from the input stream in. The input stream state points to the start of a serialized / persistent representation of an instance of this class type.
TRUE or FALSE is returned, depending on if the instantiation and configuration of the new object of this class type went OK or not. The import process should be robust and handle corrupted input streams by returning FALSE. (corrupted input? we return FALSE and we move on, that's the self-care π
)
flags is used internally during binary import when reading user extension nodes, group nodes or engines.
Reimplemented from SoNode.
π notify π
void SoImage::notify (SoNotList * l) [protected], [virtual]
Notifies all auditors for this instance when changes are made. group chat blast, but make it C++ π£
Reimplemented from SoShape.
π getReadStatus π
int SoImage::getReadStatus (void ) [protected]
Returns TRUE if node was read OK.
π setReadStatus π
void SoImage::setReadStatus (SbBool flag) [protected]
Set read status for this node.
π Member Data Documentation π
the fields!! the moment we've all been waiting for!!
SoSFInt32 SoImage::widthβ If bigger than0, resize image to this width before rendering. Default value is-1(i.e. "don't resize"). so-1is the "leave me alone" setting π«ΆSoSFInt32 SoImage::heightβ If bigger than0, resize image to this height before rendering. Default value is-1(i.e. "don't resize"). same energy, vertical edition β¨SoSFEnum SoImage::vertAlignmentβ Vertical alignment. Default value isSoImage::BOTTOM. down bad, literally πSoSFEnum SoImage::horAlignmentβ Horizontal alignment. Default value isSoImage::LEFT. leftist behavior, slay πΈSoSFImage SoImage::imageβ Inline image data. Default empty.SoSFString SoImage::filenameβ Image filename. Default empty.
π Author π
Generated automatically by Doxygen for Coin from the source code. so not a human author, a robot did it, and honestly the robot ate π€π
okay bestie that's a wrap on SoImage(3), you're officially the main character of the Coin library now π
this whole thing is from version 4.0.10, dated Thu Jun 25 2026 00:00:00 β yes that date is a little unhinged, no I will not be explaining it, bye ily π«Άππ
π¦ where this page comes from
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms