SOOFFSCREENRENDERER(3iv)
π SoOffscreenRenderer β bestie, we're rendering OFF-SCREEN π
okay so real talk, this is SoOffscreenRenderer(3IV) from the 3IV manual, and she's a whole vibe: she renders into an off-screen buffer so you can print stuff or generate texture images. no window, no drama, just pixels. β¨
πΈ INHERITS FROM πΈ
SoOffscreenRenderer
(yes bestie, she's that girl, no parent class listed, she stands alone π )
β¨ SYNOPSIS β¨
first, the invite:
#include <Inventor/SoOffscreenRenderer.h>
then the components menu, and listen, you get to pick your flavour:
enum Components {
SoOffscreenRenderer::LUMINANCE
SoOffscreenRenderer::LUMINANCE_TRANSPARENCY
SoOffscreenRenderer::RGB
SoOffscreenRenderer::RGB_TRANSPARENCY
}
and here's the full cast, the whole main-character lineup, Methods from class SoOffscreenRenderer:
SoOffscreenRenderer(const SbViewportRegion
&viewportRegion)
SoOffscreenRenderer(SoGLRenderAction *ra)
~SoOffscreenRenderer()
static float getScreenPixelsPerInch()
static SbVec2s getMaximumResolution()
void setComponents(Components components)
Components getComponents() const
void setViewportRegion(const SbViewportRegion
®ion)
const SbViewportRegion & getViewportRegion() const
void setBackgroundColor(const SbColor &c)
const SbColor & getBackgroundColor() const
void setGLRenderAction(const SoGLRenderAction *ra)
SoGLRenderAction * getGLRenderAction() const
SbBool render(SoNode *scene)
SbBool render(SoPath *scene)
unsigned char * getBuffer() const
SbBool writeToRGB(FILE *fp) const
SbBool writeToPostScript(FILE *fp) const
SbBool writeToPostScript(FILE *fp, const SbVec2f
&printSize) const
π¦ DESCRIPTION π¦
so what does she do? This class is used to render into an off-screen buffer to create a printable image or to generate a texture image. she uses X Pixmaps for rendering (yes, X Pixmaps, we love a retro icon π). and she's got methods to write that buffer out to a file β either as an RGB image or as an encapsulated PostScript description. pick your fighter. π
π METHODS π
the constructors + destructor era
SoOffscreenRenderer(const SbViewportRegion
&viewportRegion)
SoOffscreenRenderer(SoGLRenderAction *ra)
~SoOffscreenRenderer()
Constructors and destructor, obviously, it's giving birth-and-death arc. π here's the tea though: if you pass a render action to the constructor, that action gets used in all subsequent offscreen renderings. no takebacks, she's committed. otherwise, an internal instance of an SoGLRenderAction is maintained, with a viewport region set to the one you passed in by the constructor. π«Ά
static float getScreenPixelsPerInch()
returns the number of pixels per inch (in the horizontal direction) of the current X device screen. horizontal only, bestie, that's the axis we care about. π
static SbVec2s getMaximumResolution()
gets you the maximum supported resolution of the viewport. that's the ceiling, the limit, the "don't even try it" number. π
void setComponents(Components components) / Components getComponents() const
sets or returns the components to be rendered. that's it, that's the whole job. π
void setViewportRegion(const SbViewportRegion ®ion) / const SbViewportRegion & getViewportRegion() const
sets or returns the viewport region used for rendering. BUT LISTEN: this will NOT be applied to the viewport region of any render action passed in. so if you handed her an action, that action's viewport stays exactly as it was. no sneaky edits. π«
void setBackgroundColor(const SbColor &c) / const SbColor & getBackgroundColor() const
sets or returns the background color for rendering. aesthetic choices matter. π¨
void setGLRenderAction(const SoGLRenderAction *ra) / SoGLRenderAction * getGLRenderAction() const
set and get the render action to use for rendering. and this one's cute: this will return any render action passed in by the caller β so you get your action back, not a mystery one. β¨
SbBool render(SoNode *scene) / SbBool render(SoPath *scene)
renders the given scene, specified as a node or a path, into an off-screen buffer. node or path, she doesn't discriminate, she slays either way. π₯
unsigned char * getBuffer() const
returns the buffer containing the rendered image, and okay this one's important so let's go slow. the buffer is an array of unsigned characters. each pixel is stored sequentially by scanline, starting with the lower left corner (yes, bottom-left, not top-left, don't come for me π). the data stored for each pixel is determined by the Components set before rendering. pixels are stored in RGBA order and are packed without any padding between pixels or scanlines β zero gaps, tight as can be. and the buffer? it's allocated by the offscreen renderer class, and that space gets deleted when the instance is destructed. so do not free it yourself, she handles her own cleanup. π
SbBool writeToRGB(FILE *fp) const
writes the buffer as a .rgb file to the given file pointer. simple, clean, iconic. πΈ
SbBool writeToPostScript(FILE *fp) const / SbBool writeToPostScript(FILE *fp, const SbVec2f &printSize) const
writes the buffer as encapsulated PostScript. and here's the nuance bestie: if a print size is not given, the size of the image in the buffer is adjusted so it is the same as the apparent size of the viewport region on the current device. so no print size = she eyeballs it to match your device's viewport. give her a printSize and she does exactly what you said. periodt. π
quick recap for the girlies in the back: off-screen rendering, X Pixmaps, RGB or encapsulated PostScript output, buffer in RGBA order starting bottom-left, no padding, allocated and deleted by the class. memorize it, iykyk. π
and that's the whole page, bestie! this was SoOffscreenRenderer(3IV) from the 3IV manual β the footer didn't hand us a date or a version stamp to brag about, just the name itself, so that's our sign-off. mwah, go render something gorgeous. πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 Β· LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 Β· LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 Β· LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms