SoImage(3)
๐ SoImage(3) ๐ โ the manual page, but make it cute
okay so bestie, this is the manual page for SoImage(3), and it's long, so we're doing it in two parts. This is part 1. Buckle up, hydrate, and let's get into it. ๐ซถ
๐ NAME ๐
SoImage โ literally the class that draws a 2D image on the viewport. That's the whole assignment. No cap. ๐
โจ SYNOPSIS โจ
First things first, you gotta include the header:
#include <Inventor/nodes/SoImage.h>
And it inherits from SoShape. So it's a shape node, but make it 2D image energy. Iconic.
๐ธ Public Types ๐ธ
enum VertAlignment { BOTTOM, HALF, TOP }enum HorAlignment { LEFT, CENTER, RIGHT }
๐ Public Types inherited from SoShape ๐
Because SoShape said "here, take these too":
enum TriangleShape { TRIANGLE_STRIP, TRIANGLE_FAN, TRIANGLES, POLYGON,
QUADS, QUAD_STRIP, POINTS, LINES, LINE_STRIP }
๐ Public Types inherited from SoNode ๐
SoNode is the ancestor with the lore. It passed down this whole enum:
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 }
๐ Public Member Functions ๐
These are the ones SoImage itself is bringing to the table:
virtual SoType getTypeId (void) constSoImage (void)virtual void GLRender (SoGLRenderAction *action)virtual void rayPick (SoRayPickAction *action)virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)
๐ฆ Public Member Functions inherited from SoShape ๐ฆ
Bestie inherited a whole toolkit from SoShape. Look at her go:
virtual SbBool affectsState (void) const
virtual void getBoundingBox (SoGetBoundingBoxAction *action)
virtual void callback (SoCallbackAction *action)
const SoBoundingBoxCache * getBoundingBoxCache (void) const
โจ Public Member Functions inherited from SoNode โจ
And from SoNode, the mother of all node behavior:
void setOverride (const SbBool state)
SbBool isOverride (void) const
void setNodeType (const NodeType type)
NodeType getNodeType (void) const
virtual SoNode * copy (SbBool copyconnections=FALSE) const
virtual 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)
uint32_t getNodeId (void) const
virtual SoChildList * getChildren (void) const
virtual void writeInstance (SoOutput *out)
virtual SoNode * addToCopyDict (void) const
virtual void copyContents (const SoFieldContainer *from, SbBool
copyconnections)
virtual SoFieldContainer * copyThroughConnection (void) const
๐ Public Member Functions inherited from SoFieldContainer ๐
Fields? Containers? We got 'em. All inherited, all iconic:
void setToDefaults (void)
SbBool hasDefaultValues (void) const
SbBool fieldsAreEqual (const SoFieldContainer *container) const
void copyFieldValues (const SoFieldContainer *container, SbBool
copyconnections=FALSE)
SbBool set (const char *const fielddata)
void get (SbString &fielddata)
virtual int getFields (SoFieldList &l) const
virtual int getAllFields (SoFieldList &l) const
virtual SoField * getField (const SbName &name) const
virtual SoField * getEventIn (const SbName &name) const
virtual SoField * getEventOut (const SbName &name) const
SbBool getFieldName (const SoField *const field, SbName &name) const
SbBool enableNotify (const SbBool flag)
SbBool isNotifyEnabled (void) const
SbBool 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) const
virtual void getFieldsMemorySize (size_t &managed, size_t &unmanaged)
const
void setUserData (void *userdata) const
void * getUserData (void) const
๐ Public Member Functions inherited from SoBase ๐
The root of it all, SoBase, said "let me give you the fundamentals":
void ref (void) const
void unref (void) const
void unrefNoDelete (void) const
int32_t getRefCount (void) const
void touch (void)
SbBool isOfType (SoType type) const
virtual SbName getName (void) const
virtual 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) const
SbBool shouldWrite (void)
void assertAlive (void) const
๐ง Static Public Member Functions ๐ง
Static? Yes bestie. These are the ones that belong to the class itself, not an instance:
static SoType getClassTypeId (void)static void initClass (void)
๐ Static Public Member Functions inherited from SoShape ๐
static SoType getClassTypeId (void)
static void initClass (void)
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)
static void initClasses (void)
static uint32_t 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)
static SoType getClassTypeId (void)
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)
static SoType getClassTypeId (void)
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 ๐
These are the fields you can actually set on your SoImage. Slay.
SoSFInt32 widthSoSFInt32 heightSoSFEnum vertAlignmentSoSFEnum horAlignmentSoSFImage imageSoSFString filename
๐ซถ Protected Member Functions ๐ซถ
For the ones who like to subclass and get messy. Protected, so bestie, don't touch unless you're in the family:
virtual const SoFieldData * getFieldData (void) constvirtual ~SoImage ()virtual void generatePrimitives (SoAction *action)virtual void computeBBox (SoAction *action, SbBox3f &box, SbVec3f ¢er)virtual SbBool readInstance (SoInput *in, unsigned short flags)virtual void notify (SoNotList *list)int getReadStatus (void)void setReadStatus (SbBool flag)
๐ Protected Member Functions inherited from SoShape ๐
SoShape left a whole protected stash too:
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 SoTextureCoordinateElement *const
tce, const float s, const float t, const SbVec3f &normal)
void generateVertex (SoPrimitiveVertex *const pv, const SbVec3f &point,
const SbBool useTexFunc, const SoTextureCoordinateElement *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)
๐ธ Protected Member Functions inherited from SoNode ๐ธ
SoNode (void)
virtual ~SoNode ()
๐ฆ Protected Member Functions inherited from SoFieldContainer ๐ฆ
SoFieldContainer (void)
virtual ~SoFieldContainer ()
Protected Member Functions inherited from SoBase ๐ซถ
These are the protected goodies from SoBase. The manpage just lists them, so we're keeping it real and not inventing extra lore. โจ
SoBase (void)โ constructor. Inherited from SoBase, just vibing here.virtual ~SoBase ()โ destructor. Inherited, virtual, doing its cleanup thing.virtual void destroy (void)โ inherited, virtual, no extra description given.SbBool hasMultipleWriteRefs (void) constโ inherited, const, returns anSbBool.SbBool writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) constโ inherited, const, takes anSoOutput *out,SbBool isgroup, andSbBool isengine.void writeFooter (SoOutput *out) constโ inherited, const, takes anSoOutput *out.virtual const char * getFileFormatName (void) constโ inherited, virtual, const, returnsconst char *.
๐ Static Protected Member Functions
static const SoFieldData ** getFieldDataPtr (void)โ static protected member function. No extra blurb given.
๐ Static Protected Member Functions inherited from SoShape
static const SoFieldData ** getFieldDataPtr (void)โ same signature, inherited from SoShape.
๐ Static Protected Member Functions inherited from SoNode
static const SoFieldData ** getFieldDataPtr (void)โ inherited from SoNode.static void setNextActionMethodIndex (int index)โ inherited, takes anint index.static int getNextActionMethodIndex (void)โ inherited, returns anint.static void incNextActionMethodIndex (void)โ inherited, no args.static void setCompatibilityTypes (const SoType &nodetype, const uint32_t bitmask)โ inherited, takesconst SoType &nodetypeandconst uint32_t bitmask.
๐ Static Protected Member Functions inherited from SoBase
static uint32_t getCurrentWriteCounter (void)โ inherited, returnsuint32_t.static void staticDataLock (void)โ inherited, no args.static void staticDataUnlock (void)โ inherited, no args.
๐ Additional Inherited Members
Protected Types inherited from SoBase
enum BaseFlags { IS_ENGINE = 0x01, IS_GROUP = 0x02 }โ the inherited enum, with exactly those values.
Protected Attributes inherited from SoNode
uint32_t uniqueIdโ inherited protected attribute.
Protected Attributes inherited from SoFieldContainer
SbBool isBuiltInโ inherited protected attribute.
Static Protected Attributes inherited from SoNode
static uint32_t nextUniqueId = 1โ inherited static protected attribute, default1.static int nextActionMethodIndex = 0โ inherited static protected attribute, default0.
๐ Detailed Description
The SoImage class draws a 2D image on the viewport. That's the whole main character moment. ๐ผ๏ธ
You can specify an image 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. Resize, slay, display. ๐
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. So the matrix is literally deciding where your pic shows up. โจ
Here's a simple, stand-alone example on how to set up and show an SoImage:
#include <stdlib.h>
#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 it's 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. (And yes, the original says "it's positioning" โ we are not fixing the grammar, we are respecting the lore. ๐)
SoScale nodes can not be used to influence the dimensions of the rendering output of SoImage nodes. So do not try it, bestie, it will not eat. ๐ซ
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. ๐ซ
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 ar right border. (Yes, "ar". The manpage said it, we keep it. No cap. ๐)
โจ Constructor & Destructor Documentation
SoImage::SoImage (void )
Constructor. It constructs. Iconic behavior. ๐ซถ
SoImage::~SoImage () [protected], [virtual]
Destructor. Protected, virtual, and ready to clean up. ๐
๐ Member Function Documentation
SoType SoImage::getTypeId (void ) const [virtual]
Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and "downward" casting. Basically it tells you what type you're dealing with, so you can safely cast down. ๐
Usage example:
void foo(SoNode * node)
{
if (node->getTypeId() == SoFile::getClassTypeId()) {
SoFile * filenode = (SoFile *)node; // safe downward cast, knows the type
}
}
For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on. So if you're building extensions, override this, bestie. ๐ ๏ธ
For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups.
Reimplemented from SoShape.
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. Protected, virtual, and very "internal business". ๐ฆ
Reimplemented from SoShape.
void SoImage::GLRender (SoGLRenderAction * action) [virtual]
Action method for the SoGLRenderAction. This is called during rendering traversals. Nodes influencing the rendering state in any way or who wants to throw geometry primitives at OpenGL overrides this method. So if your node is doing OpenGL things, this is where the magic happens. โจ
Reimplemented from SoShape.
void SoImage::rayPick (SoRayPickAction * action) [virtual]
Calculates picked point based on primitives generated by subclasses. Ray pick, but make it virtual. ๐ฏ
Reimplemented from SoShape.
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. Nodes influencing how geometry nodes calculates their primitive count also overrides this method to change the relevant state variables. Counting primitives, very demure. ๐งฎ
Reimplemented from SoShape.
void SoImage::generatePrimitives (SoAction * action) [protected], [virtual]
Will generate a textured quad, representing the image in 3D. Protected, virtual, and it implements SoShape. Quad goals. ๐ช
Implements SoShape.
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 do not assume center is anything yet, bestie. ๐
Implements SoShape.
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 / persistant 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. flags is used internally during binary import when reading user extension nodes, group nodes or engines. (Note: "persistant" is spelled that way in the original, and we are not touching it. ๐)
Reimplemented from SoNode.
void SoImage::notify (SoNotList * l) [protected], [virtual]
Notifies all auditors for this instance when changes are made. Protected, virtual, and it reimplements SoShape. ๐ฃ
Reimplemented from SoShape.
int SoImage::getReadStatus (void ) [protected]
Returns TRUE if node was read ok. Short, sweet, protected. โ
void SoImage::setReadStatus (SbBool flag) [protected]
Set read status for this node. Takes an SbBool flag. ๐ง
๐ Member Data Documentation
SoSFInt32 SoImage::width
If bigger than 0, resize image to this width before rendering. Default value is -1 (ie "don't resize"). So -1 means leave it alone. ๐ซ๐
SoSFInt32 SoImage::height
If bigger than 0, resize image to this height before rendering. Default value is -1 (ie "don't resize"). Same energy as width. ๐
SoSFEnum SoImage::vertAlignment
Vertical alignment. Default value is SoImage::BOTTOM. โฌ๏ธ
SoSFEnum SoImage::horAlignment
Horizontal alignment. Default value is SoImage::LEFT. โฌ
๏ธ
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. The robots wrote it, we just gave it a makeover. ๐ค๐
Okay bestie, that's the whole page. It came from Coin version 3.1.3 and it's the SoImage(3) manpage. The footer didn't give us a date, so we're not inventing one โ we respect the source. ๐โจ
๐ฆ where this page comes from
- fedora 43: Coin3-devel 3.1.3-40.fc43 ยท GPL-2.0-only
- fedora 43: Coin3-devel 3.1.3-40.fc43 ยท GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 ยท GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms