OpenGL::CgOperation Class Reference

#include <CgOperation.h>

Inheritance diagram for OpenGL::CgOperation:

OpenGL::Flat3dTextureOperation OpenGL::Texture2dOperation List of all members.

Public Member Functions

 CgOperation (unsigned int computationWidth, unsigned int computationHeight, CgProgram *interior, CgProgram *boundary=0, bool normalizedTexCoords=false)
void compute (bool rtt=true)
void setOutputTexture (unsigned int texture)
void setOutputTexture (unsigned int texture, unsigned int outputWidth, unsigned int outputHeight)

Protected Member Functions

bool hasBoundaryProgram () const
unsigned int getComputationWidth () const
unsigned int getComputationHeight () const
bool hasNormalizedTexCoords () const

Private Member Functions

virtual void executeInteriorProgram ()=0
virtual void executeBoundaryProgram ()=0

Detailed Description

CgOperation is an abstraction of Cg fragment programs performing operations on textures. It uses instances of CgProgram for interior and optionally boundary operations. The user chooses which output texture to use, and the CgOperation instance determines whether swapping is required (if the output texture is also an input texture for either of the interior or boundary CgProgram instances). To perform the operation represented by an instance of CgOperation the member function compute() is offered, but it can only be called through subclasses since CgOperation is an abstract class. CgOperation is also responsible for setting the correct viewports needed when operating on the textures.


Constructor & Destructor Documentation

OpenGL::CgOperation::CgOperation unsigned int  computationWidth,
unsigned int  computationHeight,
CgProgram interior,
CgProgram boundary = 0,
bool  normalizedTexCoords = false
 

Base constructor.

Parameters:
computationWidth the width of the computation domain.
computationHeight the height of the computation domain.
interior the CgProgram instance used for interior computations.
boundary the CgProgram instance used for boundary computations.
normalizedTexCoords whether normalized texture coordinates is used.


Member Function Documentation

void OpenGL::CgOperation::compute bool  rtt = true  ) 
 

Performs one computation by executing the interior and boundary CgProgram instances. Before the computation is performed the viewport is set according to the computation width and height.

Parameters:
rtt whether the results from the CgProgram instances are written to the output texture or the frame buffer.

virtual void OpenGL::CgOperation::executeBoundaryProgram  )  [private, pure virtual]
 

Implementation of boundary CgProgram execution, must be supplied by concrete subclasses. Execution is initiated by drawing geometries.

Implemented in OpenGL::Flat3dTextureOperation, and OpenGL::Texture2dOperation.

virtual void OpenGL::CgOperation::executeInteriorProgram  )  [private, pure virtual]
 

Implementation of interior CgProgram execution, must be supplied by concrete subclasses. Execution is initiated by drawing geometries.

Implemented in OpenGL::Flat3dTextureOperation, and OpenGL::Texture2dOperation.

unsigned int OpenGL::CgOperation::getComputationHeight  )  const [protected]
 

Returns the computation height.

Returns:
the computation height.

unsigned int OpenGL::CgOperation::getComputationWidth  )  const [protected]
 

Returns the computation width.

Returns:
the computation width.

bool OpenGL::CgOperation::hasBoundaryProgram  )  const [protected]
 

Returns whether the CgOperation instance has a boundary CgProgram;

Returns:
whether the CgOperation instance has a boundary CgProgram;

bool OpenGL::CgOperation::hasNormalizedTexCoords  )  const [protected]
 

Returns whether the CgOperation instance uses normalized texture coordinates.

Returns:
whether the CgOperation instance uses normalized texture coordinates.

void OpenGL::CgOperation::setOutputTexture unsigned int  texture,
unsigned int  outputWidth,
unsigned int  outputHeight
 

Sets the output texture used as render target when compute() is called. This function should be used if the output texture dimensions differ from the computation width and height. The texture identifier must be valid in the IoTextureSet instance used by the interior and boundary CgProgram instances.

Parameters:
texture the texture identifier of the output texture.
outputWidth the new computation width.
outputHeight the new computation height.

void OpenGL::CgOperation::setOutputTexture unsigned int  texture  ) 
 

Sets the output texture used as render target when compute() is called. The texture identifier must be valid in the IoTextureSet instance used by the interior and boundary CgProgram instances.

Parameters:
texture the texture identifier of the output texture.


The documentation for this class was generated from the following files:
Generated on Fri Jun 16 08:42:52 2006 for GPU Thesis by  doxygen 1.4.6-NO