Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

SoOffscreenRenderer Class Reference

The SoOffscreenRenderer class is used for rendering scenes in offscreen buffers. More...

#include <Inventor/SoOffscreenRenderer.h>

List of all members.

Public Types

enum  Components { LUMINANCE = 1, LUMINANCE_TRANSPARENCY = 2, RGB = 3, RGB_TRANSPARENCY = 4 }

Public Methods

 SoOffscreenRenderer (const SbViewportRegion &viewportregion)
 SoOffscreenRenderer (SoGLRenderAction *action)
 ~SoOffscreenRenderer ()
void setComponents (const Components components)
Components getComponents (void) const
void setViewportRegion (const SbViewportRegion &region)
const SbViewportRegiongetViewportRegion (void) const
void setBackgroundColor (const SbColor &color)
const SbColorgetBackgroundColor (void) const
void setGLRenderAction (SoGLRenderAction *action)
SoGLRenderActiongetGLRenderAction (void) const
SbBool render (SoNode *scene)
SbBool render (SoPath *scene)
unsigned char * getBuffer (void) const
SbBool writeToRGB (FILE *fp) const
SbBool writeToPostScript (FILE *fp) const
SbBool writeToPostScript (FILE *fp, const SbVec2f &printsize) const
SbBool writeToRGB (const char *filename) const
SbBool writeToPostScript (const char *filename) const
SbBool writeToPostScript (const char *filename, const SbVec2f &printsize) const
SbBool isWriteSupported (const SbName &filetypeextension) const
int getNumWriteFiletypes (void) const
void getWriteFiletypeInfo (const int idx, SbList< SbName > &extlist, SbString &fullname, SbString &description)
SbBool writeToFile (const SbString &filename, const SbName &filetypeextension) const

Static Public Methods

float getScreenPixelsPerInch (void)
SbVec2s getMaximumResolution (void)


Detailed Description

The SoOffscreenRenderer class is used for rendering scenes in offscreen buffers.

If you want to render to a memory buffer instead of an on-screen OpenGL context, use this class. Rendering to a memory buffer can be used to generate texture maps on-the-fly, or for saving snapshots of the scene to disk files (as pixel bitmaps or as Postscript files for sending to a Postscript-capable printer).

Currently offscreen rendering can be done with GLX (i.e. OpenGL on X11) and WGL (i.e. OpenGL on Win32).


Member Enumeration Documentation

enum SoOffscreenRenderer::Components
 

Enumerated values for the available image formats.

See also:
setComponents()


Constructor & Destructor Documentation

SoOffscreenRenderer::SoOffscreenRenderer const SbViewportRegion   viewportregion
 

Constructor. Argument is the viewportregion we should use when rendering. An internal SoGLRenderAction will be constructed.

SoOffscreenRenderer::SoOffscreenRenderer SoGLRenderAction   action
 

Constructor. Argument is the action we should apply to the scene graph when rendering the scene. Information about the viewport is extracted from the action.

SoOffscreenRenderer::~SoOffscreenRenderer  
 

Destructor.


Member Function Documentation

float SoOffscreenRenderer::getScreenPixelsPerInch void    [static]
 

Returns the screen pixels per inch resolution of your monitor.

SbVec2s SoOffscreenRenderer::getMaximumResolution void    [static]
 

Get maximum dimensions (width, height) of the offscreen buffer.

void SoOffscreenRenderer::setComponents const Components    components
 

Sets the component format of the offscreen buffer.

If set to LUMINANCE, a grayscale image is rendered, LUMINANCE_TRANSPARENCY gives us a grayscale image with transparency, RGB will give us a 24-bit image with 8 bits each for the red, green and blue component, and RGB_TRANSPARENCY yields a 32-bit image (RGB plus transparency).

The default format to render to is RGB.

SoOffscreenRenderer::Components SoOffscreenRenderer::getComponents void    const
 

Returns the component format of the offscreen buffer.

See also:
setComponents()

void SoOffscreenRenderer::setViewportRegion const SbViewportRegion   region
 

Sets the viewport region.

const SbViewportRegion & SoOffscreenRenderer::getViewportRegion void    const
 

Returns the viewerport region.

void SoOffscreenRenderer::setBackgroundColor const SbColor   color
 

Sets the background color. The buffer is cleared to this color before rendering.

const SbColor & SoOffscreenRenderer::getBackgroundColor void    const
 

Returns the background color.

void SoOffscreenRenderer::setGLRenderAction SoGLRenderAction   action
 

Sets the render action. Use this if you have special rendering needs.

SoGLRenderAction * SoOffscreenRenderer::getGLRenderAction void    const
 

Returns the rendering action currently used.

SbBool SoOffscreenRenderer::render SoNode   scene
 

Render scene into our internal memory buffer.

SbBool SoOffscreenRenderer::render SoPath   scene
 

Render the scene path into our internal memory buffer.

unsigned char * SoOffscreenRenderer::getBuffer void    const
 

Returns the offscreen memory buffer.

SbBool SoOffscreenRenderer::writeToRGB FILE *    fp const
 

Writes the buffer in SGI RGB format by appending it to the already open file. Returns FALSE if writing fails.

Important note: do not use this method when the Coin library has been compiled as an MSWindows DLL, as passing FILE* instances back or forth to DLLs is dangerous and will most likely cause a crash. This is an intrinsic limitation for MSWindows DLLs.

SbBool SoOffscreenRenderer::writeToPostScript FILE *    fp const
 

Writes the buffer in Postscript format by appending it to the already open file. Returns FALSE if writing fails.

Important note: do not use this method when the Coin library has been compiled as an MSWindows DLL, as passing FILE* instances back or forth to DLLs is dangerous and will most likely cause a crash. This is an intrinsic limitation for MSWindows DLLs.

SbBool SoOffscreenRenderer::writeToPostScript FILE *    fp,
const SbVec2f   printsize
const
 

Writes the buffer to a file in Postscript format, with printsize dimensions.

Important note: do not use this method when the Coin library has been compiled as an MSWindows DLL, as passing FILE* instances back or forth to DLLs is dangerous and will most likely cause a crash. This is an intrinsic limitation for MSWindows DLLs.

SbBool SoOffscreenRenderer::writeToRGB const char *    filename const
 

Opens a file with the given name and writes the offscreen buffer in SGI RGB format to the new file. If the file already exists, it will be overwritten (if permitted by the filesystem).

Returns TRUE if all went ok, otherwise FALSE.

SbBool SoOffscreenRenderer::writeToPostScript const char *    filename const
 

Opens a file with the given name and writes the offscreen buffer in Postscript format to the new file. If the file already exists, it will be overwritten (if permitted by the filesystem).

Returns TRUE if all went ok, otherwise FALSE.

SbBool SoOffscreenRenderer::writeToPostScript const char *    filename,
const SbVec2f   printsize
const
 

Opens a file with the given name and writes the offscreen buffer in Postscript format with printsize dimensions to the new file. If the file already exists, it will be overwritten (if permitted by the filesystem).

Returns TRUE if all went ok, otherwise FALSE.

SbBool SoOffscreenRenderer::isWriteSupported const SbName   filetypeextension const
 

Returns TRUE if the buffer can be saved as a file of type filetypeextension, using SoOffscreenRenderer::writeToFile(). This function needs simage v1.1 or newer. Examples of supported extensions are: jpg, png, tiff and rgb. The extension match is not case sensitive.

This method is an extension versus the Open Inventor API.

See also:
getNumWriteFiletypes(), getWriteFiletypeInfo(), writeToFile()

int SoOffscreenRenderer::getNumWriteFiletypes void    const
 

Returns the number of available exporters. Information about exporters can be found using getNumWriteFiletypes().

This method is an extension versus the Open Inventor API.

See also:
getWriteFiletypeInfo()

void SoOffscreenRenderer::getWriteFiletypeInfo const int    idx,
SbList< SbName > &    extlist,
SbString   fullname,
SbString   description
 

Returns information about an image exporter. extlist is a list of filenameextensions for a file format. E.g. for JPEG it is legal to use both jpg and jpeg. fullname is the full name of the image format. description is an optional string with more information about the file format.

This method is an extension versus the Open Inventor API.

See also:
getNumWriteFiletypes(), writeToFile()

SbBool SoOffscreenRenderer::writeToFile const SbString   filename,
const SbName   filetypeextension
const
 

Saves the buffer to filename, in the filetype specified by filetypeextensions.

This method is an extension versus the Open Inventor API.

See also:
isWriteSupported()


The documentation for this class was generated from the following files:
Generated on Sat Jan 12 11:41:11 2002 for Coin by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001