Om
1.0.0
A universal framework for multimedia simulation
|
The base class for objects that use a graphics context to do rendering. More...
#include <omGraphicsContextObject.h>
Public Member Functions | |
virtual | ~GraphicsContextObject () |
Destory this graphics context object. More... | |
GraphicsContext * | getContext () 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 | |
GraphicsContext * | context |
A pointer to the graphics context this object is using. More... | |
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.
|
virtual |
Destory this graphics context object.
|
inlineprotected |
Create a new graphics context object that doesn't have an associated graphics context.
|
inlineprotected |
Create a new graphics context object that uses the specified context for rendering.
|
inline |
Return a pointer to the graphics context this context object is using to do rendering.
|
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.
|
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 |
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.
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::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 |
Download the resource's GPU representation to CPU memory.
The method returns whether or not the resource's data was able to be successfully downloaded from the device. The downloaded data replaces the current CPU-side representation of the resource and stores a copy of the object's data in CPU memory. A valid context is required for the upload to succeed.
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::scenes::GraphicsObject, om::graphics::shapes::LODShape, 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.
|
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 |
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 |
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.
|
protected |
A pointer to the graphics context this object is using.