Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
om::graphics::devices::GraphicsContextObject Class Reference

The base class for objects that use a graphics context to do rendering. More...

#include <omGraphicsContextObject.h>

Inheritance diagram for om::graphics::devices::GraphicsContextObject:
om::graphics::base::Renderable om::graphics::buffers::Buffer om::graphics::buffers::VertexBufferSet om::graphics::materials::Material om::graphics::materials::Technique om::graphics::materials::TechniqueLibrary om::graphics::shapes::MeshGroup om::graphics::textures::Framebuffer om::graphics::textures::Texture om::graphics::textures::TextureSet

Public Member Functions

virtual ~GraphicsContextObject ()
 Destory this graphics context object. More...
 
GraphicsContextgetContext () const
 Return a pointer to the graphics context this context object is using to do rendering. More...
 
virtual void setContext (GraphicsContext *newContext)
 Set a pointer to the graphics context this context object should use to do rendering. More...
 
void clearContext ()
 Clear the previous context from this object. More...
 
void upload ()
 Upload this resource's CPU representation to the GPU device. More...
 
virtual void upload (UploadRequest &request)
 Upload this resource's CPU representation to the GPU device. More...
 
void download ()
 Upload this resource's CPU representation to the GPU device. More...
 
virtual void download (DownloadRequest &request)
 Download the resource's GPU representation to CPU memory. More...
 
virtual Bool isUploaded () const
 Return whether or not this graphics resource has been successfully created and uploaded to the device. More...
 
virtual Bool isDownloaded () const
 Return whether or not this graphics resource has a copy of its data stored in CPU-side memory. More...
 
virtual Bool isValid () const
 Return whether or not the state of this graphics resource is valid (either on CPU or GPU) and able to be used for rendering. More...
 

Protected Member Functions

 GraphicsContextObject ()
 Create a new graphics context object that doesn't have an associated graphics context. More...
 
 GraphicsContextObject (GraphicsContext *newContext)
 Create a new graphics context object that uses the specified context for rendering. More...
 

Protected Attributes

GraphicsContextcontext
 A pointer to the graphics context this object is using. More...
 

Detailed Description

The base class for objects that use a graphics context to do rendering.

A graphics context object is associated with a graphics context which must be valid in order for the object to be used for rendering.

Constructor & Destructor Documentation

virtual om::graphics::devices::GraphicsContextObject::~GraphicsContextObject ( )
virtual

Destory this graphics context object.

om::graphics::devices::GraphicsContextObject::GraphicsContextObject ( )
inlineprotected

Create a new graphics context object that doesn't have an associated graphics context.

om::graphics::devices::GraphicsContextObject::GraphicsContextObject ( GraphicsContext newContext)
inlineprotected

Create a new graphics context object that uses the specified context for rendering.

Member Function Documentation

GraphicsContext* om::graphics::devices::GraphicsContextObject::getContext ( ) const
inline

Return a pointer to the graphics context this context object is using to do rendering.

virtual void om::graphics::devices::GraphicsContextObject::setContext ( GraphicsContext newContext)
virtual

Set a pointer to the graphics context this context object should use to do rendering.

The object cannot be used for rendering until it has been uploaded to the context. If an object has already been uploaded to a context, it is reuploaded to the new one. If the new context is NULL, any previously uploaded data is deallocated.

The context object subclass should override this method to perform any initialization and configuration for the new context.

Reimplemented in om::graphics::materials::Technique, om::graphics::buffers::Buffer, om::graphics::materials::Material, om::graphics::textures::Texture, om::graphics::scenes::GraphicsScene, om::graphics::shapes::BoxShape, om::graphics::textures::Framebuffer, om::graphics::shapes::SkyBoxShape, om::graphics::shapes::MeshGroup, om::graphics::shapes::GridShape, om::graphics::shapes::LODShape, om::graphics::scenes::GraphicsObject, om::graphics::buffers::VertexBufferSet, om::graphics::shapes::MeshShape, om::graphics::textures::TextureSet, om::graphics::shapes::TransformControl, om::graphics::materials::TechniqueLibrary, om::graphics::shapes::SubdivisionShape, and om::graphics::shapes::SphericalFunctionShape.

void om::graphics::devices::GraphicsContextObject::clearContext ( )
inline

Clear the previous context from this object.

void om::graphics::devices::GraphicsContextObject::upload ( )

Upload this resource's CPU representation to the GPU device.

The method performs whatever operations are necessary to create and upload the resource's data to the GPU and then returns whether or not the operation was successful. A valid context is required for the upload to succeed.

virtual void om::graphics::devices::GraphicsContextObject::upload ( UploadRequest request)
virtual
void om::graphics::devices::GraphicsContextObject::download ( )

Upload this resource's CPU representation to the GPU device.

The method performs whatever operations are necessary to create and upload the resource's data to the GPU and then returns whether or not the operation was successful. A valid context is required for the upload to succeed.

virtual void om::graphics::devices::GraphicsContextObject::download ( DownloadRequest request)
virtual
virtual Bool om::graphics::devices::GraphicsContextObject::isUploaded ( ) const
virtual

Return whether or not this graphics resource has been successfully created and uploaded to the device.

The default implementation returns FALSE, indicating that the object is CPU-only and cannot be uploaded. Override this method to return the correct upload state.

Reimplemented in om::graphics::materials::Technique, om::graphics::buffers::Buffer, om::graphics::textures::Texture, and om::graphics::textures::Framebuffer.

virtual Bool om::graphics::devices::GraphicsContextObject::isDownloaded ( ) const
virtual

Return whether or not this graphics resource has a copy of its data stored in CPU-side memory.

The default implementation returns TRUE, indicating that the object is CPU memory resident. Override this method to return the correct downloaded state.

Reimplemented in om::graphics::materials::Technique, om::graphics::buffers::Buffer, om::graphics::textures::Texture, and om::graphics::textures::Framebuffer.

virtual Bool om::graphics::devices::GraphicsContextObject::isValid ( ) const
virtual

Return whether or not the state of this graphics resource is valid (either on CPU or GPU) and able to be used for rendering.

The default implementation returns whether or not the context is valid.

Reimplemented in om::graphics::materials::Technique, om::graphics::buffers::Buffer, om::graphics::textures::Texture, and om::graphics::textures::Framebuffer.

Member Data Documentation

GraphicsContext* om::graphics::devices::GraphicsContextObject::context
protected

A pointer to the graphics context this object is using.


The documentation for this class was generated from the following file: