Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::graphics::devices::GraphicsContext Class Referenceabstract

A class that represents an instance of a graphics device renderer. More...

#include <omGraphicsContext.h>

Inheritance diagram for om::graphics::devices::GraphicsContext:
om::graphics::devices::opengl::OpenGLContext

Public Member Functions

virtual ~GraphicsContext ()
 Destroy a graphics context, releasing all of its resources and internal state. More...
 
virtual Bool addView (gui::RenderView *newView)=0
 Add a new target view to this context that it should render to. More...
 
virtual Bool removeView (const gui::RenderView *newView)=0
 Remove a previous view from this context so that it cannot be rendered to anymore. More...
 
virtual void clearViews ()=0
 Remove all previously associated views from this context. More...
 
virtual gui::RenderViewgetTargetView () const =0
 Return a pointer to the target render view at the given index that this context can render to. More...
 
virtual Bool setTargetView (gui::RenderView *newView)=0
 Set the target view that this context should render to. More...
 
virtual Bool isValid () const =0
 Return whether or not this context is valid and can be used for rendering. More...
 
virtual const GraphicsContextCapabilitiesgetCapabilities () const =0
 Return an object that describes the different capabilities of this graphics context. More...
 
Bool hasCapabilities (const GraphicsContextCapabilities &capabilities)
 Return whether or not this graphics context supports the specified capabilities. More...
 
virtual Bool isCurrent ()=0
 Return whether or not this context is the current context for the calling thread. More...
 
virtual Bool makeCurrent ()=0
 Make this context the active context for the calling thread for the current target view. More...
 
virtual Bool swapBuffers ()=0
 Flush all rendering commands and swap the front buffer with the back buffer. More...
 
virtual Bool getVSync () const =0
 Return whether or not vertical screen refresh synchronization is enabled. More...
 
virtual Bool setVSync (Bool newVSync)=0
 Set whether or not vertical screen refresh synchronization should be enabled. More...
 
virtual void flush ()=0
 Flush all rendering commands into the graphics pipeline. More...
 
virtual void finish ()=0
 Flush all rendering commands into the graphics pipeline and wait until they are complete. More...
 
virtual RenderMode getRenderMode () const =0
 Return an object that contains information about the current state of the context's renderer. More...
 
virtual Bool setRenderMode (const RenderMode &newRenderMode)=0
 Set the mode of the context's renderer. More...
 
virtual RenderFlags getRenderFlags () const =0
 Return an object that contains boolan flags for the current state of the context's renderer. More...
 
virtual Bool setRenderFlags (const RenderFlags &newRenderFlags)=0
 Set an object that contains boolan flags for the current state of the context's renderer. More...
 
virtual Bool getRenderFlagIsSet (RenderFlags::Flag flag) const =0
 Return whether or not a certain render flag is currently set. More...
 
virtual Bool setRenderFlag (RenderFlags::Flag flag, Bool value=true)=0
 Set whether or not a certain render flag should be set. More...
 
virtual DepthMode getDepthMode () const =0
 Return an object that contains information about the current state of the context's depth test pipeline. More...
 
virtual Bool setDepthMode (const DepthMode &newDepthMode)=0
 Set the mode of the context's depth test pipeline. More...
 
virtual StencilMode getStencilMode () const =0
 Return an object that contains information about the current state of the context's stencil test pipeline. More...
 
virtual Bool setStencilMode (const StencilMode &newStencilMode)=0
 Set the mode of the context's stencil test pipeline. More...
 
virtual BlendMode getBlendMode () const =0
 Return an object that contains information about the current state of the context's blending pipeline. More...
 
virtual Bool setBlendMode (const BlendMode &newBlendMode)=0
 Set the mode of the context's blending pipeline. More...
 
virtual Float getLineWidth () const =0
 Return the width in pixels to use when rendering lines. More...
 
virtual Bool setLineWidth (Float newLineWidth)=0
 Set the width in pixels to use when rendering lines. More...
 
virtual Float getPointSize () const =0
 Return the size in pixels to use when rendering points. More...
 
virtual Bool setPointSize (Float newPointSize)=0
 Set the size in pixels to use when rendering points. More...
 
virtual Viewport getViewport () const =0
 Return an object representing the current viewport for this graphics context. More...
 
virtual Bool setViewport (const Viewport &newViewport)=0
 Set the viewport to use for this graphics context. More...
 
Size2D getViewportSize () const
 Return a 2D vector containing the size in framebuffer pixels of the current viewport. More...
 
virtual ScissorTest getScissorTest () const =0
 Return an object representing the current scissor test for this graphics context. More...
 
virtual Bool setScissorTest (const ScissorTest &newScissorTest)=0
 Set an object representing the current scissor test for this graphics context. More...
 
virtual void clearColorBuffer (const Color4d &clearColor)=0
 Clear the contents of the color buffer, writing the specified color to every pixel. More...
 
virtual void clearDepthBuffer (Double clearDepth)=0
 Clear the contents of the depth buffer, writing the specified depth to every pixel. More...
 
virtual void clearStencilBuffer (Int clearStencil)=0
 Clear the contents of the stencil buffer, writing the specified integer value to every pixel. More...
 
virtual Bool readColorBuffer (const PixelFormat &pixelType, Image &image) const =0
 Read an image corresponding to the entire contents of the context's current color buffer. More...
 
virtual Bool readColorBuffer (const PixelFormat &pixelType, Image &image, const AABB2i &bounds) const =0
 Read an image corresponding to the specified contents of the context's current color buffer. More...
 
virtual Bool readDepthBuffer (const PixelFormat &pixelType, Image &image) const =0
 Read an image corresponding to the entire contents of the context's current depth buffer. More...
 
virtual Bool readDepthBuffer (const PixelFormat &pixelType, Image &image, const AABB2i &bounds) const =0
 Read an image corresponding to the specified contents of the context's current depth buffer. More...
 
virtual Size2D getFramebufferSize () const =0
 Return a 2D vector containing the size in pixels of the currently bound framebuffer. More...
 
virtual Shared< FramebuffergetFramebuffer () const =0
 Return a pointer to the currently bound framebuffer object. More...
 
virtual Bool bindFramebuffer (const Shared< Framebuffer > &newFramebuffer)=0
 Set the currently bound framebuffer object. More...
 
virtual void unbindFramebuffer ()=0
 Unbind the previously bound framebuffer, restoring the main screen as the target. More...
 
virtual Bool draw (const RenderMode &renderMode, const DeviceShaderProgram &program, const ShaderBindingSet &shaderBindings, const ShaderBindingData &shaderData, const IndexRange &indexRange, const IndexBuffer *indices=((void *) 0))=0
 Using the given render mode and shader program, shader bindings, and shader data, draw a range of primitives. More...
 
virtual Shared< DeviceBuffercreateBuffer (const BufferType &bufferType, const BufferUsage &newUsage=BufferUsage::STATIC)=0
 Create a buffer with the specified buffer type with undefined capacity and the given usage. More...
 
virtual Shared< DeviceBuffercreateBuffer (const BufferType &bufferType, Size capacity, const BufferUsage &newUsage=BufferUsage::STATIC)=0
 Create a buffer with the specified buffer type, capacity in bytes, and usage. More...
 
virtual Shared< DeviceBuffercreateBuffer (const BufferType &bufferType, Size capacity, const void *data, const BufferUsage &newUsage=BufferUsage::STATIC)=0
 Create a buffer with the specified buffer type, capacity in bytes, and data source. More...
 
virtual Shared< DeviceTexturecreateTexture1D (TextureFormat format, Size width)=0
 Create a 1D texture with the specified internal format and size with undefined pixel data. More...
 
virtual Shared< DeviceTexturecreateTexture2D (TextureFormat format, Size width, Size height)=0
 Create a 2D texture with the specified internal format and size with undefined pixel data. More...
 
virtual Shared< DeviceTexturecreateTexture3D (TextureFormat format, Size width, Size height, Size depth)=0
 Create a 3D texture with the specified internal format and size with undefined pixel data. More...
 
virtual Shared< DeviceTexturecreateTextureCube (TextureFormat format, Size width)=0
 Create a 2D cube map texture with the specified internal format and size with undefined pixel data. More...
 
Shared< DeviceTexturecreateTexture (const Image &image)
 Create a texture for the specified image which uses an inferred internal texture format. More...
 
virtual Shared< DeviceTexturecreateTexture (const Image &image, TextureFormat format)=0
 Create a texture for the specified image which has the given internal texture format. More...
 
virtual Shared< DeviceFramebuffercreateFramebuffer ()=0
 Create a new framebuffer object for this context. More...
 
virtual Shared< DeviceShadercreateShader (const ShaderType &newShaderType, const ShaderSourceString &newSource, const ShaderLanguage &newLanguage=ShaderLanguage::DEFAULT, StringOutputStream *compilationLog=((void *) 0))=0
 Create and compile a new shader with the specified type and source code. More...
 
virtual Shared< DeviceShaderProgramcreateShaderProgram ()=0
 Create a new shader program object with no attached shaders. More...
 
virtual Shared< DeviceShaderProgramcreateShaderProgram (const ShaderProgramSource &programSource, const ShaderConfiguration *configuration=((void *) 0), StringOutputStream *compilationLog=((void *) 0))=0
 Create a new shader program object that uses the specified shader program source code. More...
 
virtual Bool getBestProgramSource (const ShaderProgram &shaderProgram, Index &sourceIndex) const =0
 Get the index of the best shader program source to use for this context from the given shader program. More...
 
virtual const ShaderProgramgetDefaultProgram (const TechniqueUsage &usage)=0
 Return a pointer to a default shader pass object for the given technique usage. More...
 
virtual const ShaderProgramLibrarygetDefaultProgramLibrary () const =0
 Return a pointer to a shader program library that contains default shader programs for the context. More...
 

Detailed Description

A class that represents an instance of a graphics device renderer.

Specialized implementations inherit from this interface to provide a way to provide uniform access to their underlying drivers. For instance, there could be a class OpenGLContext which inherits from GraphicsContext and represents an OpenGL device driver context.

Constructor & Destructor Documentation

virtual om::graphics::devices::GraphicsContext::~GraphicsContext ( )
inlinevirtual

Destroy a graphics context, releasing all of its resources and internal state.

Member Function Documentation

virtual Bool om::graphics::devices::GraphicsContext::addView ( gui::RenderView newView)
pure virtual

Add a new target view to this context that it should render to.

This method initializes an internal rendering context for the view so that it can be rendered to using the context.

If the new view is the first view that this context has, the view is automatically set to be the target view for the context.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::removeView ( const gui::RenderView newView)
pure virtual

Remove a previous view from this context so that it cannot be rendered to anymore.

The internal context for the view is destroyed and the method returns whether or not the view was removed successfully.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual void om::graphics::devices::GraphicsContext::clearViews ( )
pure virtual

Remove all previously associated views from this context.

After this method call, the context cannot be used for rendering until a new view is added.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual gui::RenderView* om::graphics::devices::GraphicsContext::getTargetView ( ) const
pure virtual

Return a pointer to the target render view at the given index that this context can render to.

If there is no valid target view to render to, the function returns a NULL pointer.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setTargetView ( gui::RenderView newView)
pure virtual

Set the target view that this context should render to.

The method returns whether or not the context is able to render to the view.

If the context has not used the view before, the view is initialized for rendering. and added to the context.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::isValid ( ) const
pure virtual

Return whether or not this context is valid and can be used for rendering.

Users should check the return value of this method after context creation to ensure that the context was successfully created.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual const GraphicsContextCapabilities& om::graphics::devices::GraphicsContext::getCapabilities ( ) const
pure virtual

Return an object that describes the different capabilities of this graphics context.

Implemented in om::graphics::devices::opengl::OpenGLContext.

Bool om::graphics::devices::GraphicsContext::hasCapabilities ( const GraphicsContextCapabilities capabilities)
inline

Return whether or not this graphics context supports the specified capabilities.

This method allows testing for multiple capabilities at once. The function returns TRUE only if all of the specified capability flags are set.

virtual Bool om::graphics::devices::GraphicsContext::isCurrent ( )
pure virtual

Return whether or not this context is the current context for the calling thread.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::makeCurrent ( )
pure virtual

Make this context the active context for the calling thread for the current target view.

If the method fails and this context is not able to be made the current context, FALSE is returned. Otherwise, TRUE is returned indicating success.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::swapBuffers ( )
pure virtual

Flush all rendering commands and swap the front buffer with the back buffer.

This has the effect of displaying the frame which was just drawn using the context. In practice, the user should call this method after drawing each frame using the context. If v-sync is enabled, this method waits until the next vertical screen refresh to copy the front buffer to the back buffer.

If the context is single-buffered, this method has no effect.

The method returns whether or not the operation was successful.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::getVSync ( ) const
pure virtual

Return whether or not vertical screen refresh synchronization is enabled.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setVSync ( Bool  newVSync)
pure virtual

Set whether or not vertical screen refresh synchronization should be enabled.

The method returns whether or not setting the V-Sync status was successful.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual void om::graphics::devices::GraphicsContext::flush ( )
pure virtual

Flush all rendering commands into the graphics pipeline.

This method can be called to force all queued rendering commands to be executed immediately by the context.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual void om::graphics::devices::GraphicsContext::finish ( )
pure virtual

Flush all rendering commands into the graphics pipeline and wait until they are complete.

This method can be called to force all queued rendering commands to be executed immediately by the context. The method waits until all of the queued commands are executed and finish executing, then returns.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual RenderMode om::graphics::devices::GraphicsContext::getRenderMode ( ) const
pure virtual

Return an object that contains information about the current state of the context's renderer.

A context's render mode encapsulates various attributes of the fixed-function graphics pipeline, such as the blending mode, depth mode, and stencil mode.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setRenderMode ( const RenderMode newRenderMode)
pure virtual

Set the mode of the context's renderer.

If the method succeeds, the render mode of the context's graphics pipeline is set to have the requested state and TRUE is returned. Otherwise, if some part of the state was unable to be applied, FALSE is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual RenderFlags om::graphics::devices::GraphicsContext::getRenderFlags ( ) const
pure virtual

Return an object that contains boolan flags for the current state of the context's renderer.

These flags indicate the enabled/disabled state for various parts of the fixed-function graphics pipeline.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setRenderFlags ( const RenderFlags newRenderFlags)
pure virtual

Set an object that contains boolan flags for the current state of the context's renderer.

If the method succeeds, the render flags of the context's graphics pipeline are set to have the requested state and TRUE is returned. Otherwise, if some part of the state was unable to be applied, FALSE is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::getRenderFlagIsSet ( RenderFlags::Flag  flag) const
pure virtual

Return whether or not a certain render flag is currently set.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setRenderFlag ( RenderFlags::Flag  flag,
Bool  value = true 
)
pure virtual

Set whether or not a certain render flag should be set.

If the method succeeds, the render flags of the context's graphics pipeline are set so that the given flag has the specified value and TRUE is returned. Otherwise, if the state was unable to be applied, FALSE is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual DepthMode om::graphics::devices::GraphicsContext::getDepthMode ( ) const
pure virtual

Return an object that contains information about the current state of the context's depth test pipeline.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setDepthMode ( const DepthMode newDepthMode)
pure virtual

Set the mode of the context's depth test pipeline.

If the method succeeds, the depth mode of the context's graphics pipeline is set to have the requested state and TRUE is returned. Otherwise, if some part of the state was unable to be applied, FALSE is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual StencilMode om::graphics::devices::GraphicsContext::getStencilMode ( ) const
pure virtual

Return an object that contains information about the current state of the context's stencil test pipeline.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setStencilMode ( const StencilMode newStencilMode)
pure virtual

Set the mode of the context's stencil test pipeline.

If the method succeeds, the stencil mode of the context's graphics pipeline is set to have the requested state and TRUE is returned. Otherwise, if some part of the state was unable to be applied, FALSE is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual BlendMode om::graphics::devices::GraphicsContext::getBlendMode ( ) const
pure virtual

Return an object that contains information about the current state of the context's blending pipeline.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setBlendMode ( const BlendMode newBlendMode)
pure virtual

Set the mode of the context's blending pipeline.

If the method succeeds, the blending mode of the context's graphics pipeline is set to have the requested state and TRUE is returned. Otherwise, if some part of the state was unable to be applied, FALSE is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Float om::graphics::devices::GraphicsContext::getLineWidth ( ) const
pure virtual

Return the width in pixels to use when rendering lines.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setLineWidth ( Float  newLineWidth)
pure virtual

Set the width in pixels to use when rendering lines.

If the method succeeds, the line width of the context's graphics pipeline is set to have the requested size in pixels and TRUE is returned. Otherwise, if the line width was unable to be set, FALSE is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Float om::graphics::devices::GraphicsContext::getPointSize ( ) const
pure virtual

Return the size in pixels to use when rendering points.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setPointSize ( Float  newPointSize)
pure virtual

Set the size in pixels to use when rendering points.

If the method succeeds, the point size of the context's graphics pipeline is set to have the requested size in pixels and TRUE is returned. Otherwise, if the point size was unable to be set, FALSE is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Viewport om::graphics::devices::GraphicsContext::getViewport ( ) const
pure virtual

Return an object representing the current viewport for this graphics context.

This is the rectangular area of the context's target view that is being rendered to by the context. Coordinates are specified where (0,0) is the lower left-corner of the screen, and (1,1) is the upper-right corner.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setViewport ( const Viewport newViewport)
pure virtual

Set the viewport to use for this graphics context.

This is the rectangular area of the context's target view that is being rendered to by the context. Coordinates are specified where (0,0) is the lower left-corner of the screen, and (1,1) is the upper-right corner.

The method returns whether or not the viewport change operation was successful.

Implemented in om::graphics::devices::opengl::OpenGLContext.

Size2D om::graphics::devices::GraphicsContext::getViewportSize ( ) const
inline

Return a 2D vector containing the size in framebuffer pixels of the current viewport.

virtual ScissorTest om::graphics::devices::GraphicsContext::getScissorTest ( ) const
pure virtual

Return an object representing the current scissor test for this graphics context.

This is the rectangular area of the context's target view that is being rendered to by the context. The scissor rectangle allows the user to clip rendering to a rectangular region within a viewport without affecting the screen-space viewport transformation.

Coordinates are specified where (0,0) is the lower left-corner of the screen, and (1,1) is the upper-right corner.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::setScissorTest ( const ScissorTest newScissorTest)
pure virtual

Set an object representing the current scissor test for this graphics context.

This is the rectangular area of the context's target view that is being rendered to by the context. The scissor rectangle allows the user to clip rendering to a rectangular region within a viewport without affecting the screen-space viewport transformation.

Coordinates are specified where (0,0) is the lower left-corner of the screen, and (1,1) is the upper-right corner.

The method returns whether or not the scissor test change operation was successful.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual void om::graphics::devices::GraphicsContext::clearColorBuffer ( const Color4d &  clearColor)
pure virtual

Clear the contents of the color buffer, writing the specified color to every pixel.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual void om::graphics::devices::GraphicsContext::clearDepthBuffer ( Double  clearDepth)
pure virtual

Clear the contents of the depth buffer, writing the specified depth to every pixel.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual void om::graphics::devices::GraphicsContext::clearStencilBuffer ( Int  clearStencil)
pure virtual

Clear the contents of the stencil buffer, writing the specified integer value to every pixel.

This integer value is masked so that the final N-bit stencil value contains the lower-order N bits of the specified integer.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::readColorBuffer ( const PixelFormat &  pixelType,
Image &  image 
) const
pure virtual

Read an image corresponding to the entire contents of the context's current color buffer.

The color buffer is read from and its contents are placed in the output image parameter with the specified pixel type. If the pixel type is incompatible with the framebuffer format, or if the read operation failed, FALSE is returned and no image is retrieved. Otherwise, TRUE is returned and the method succeeds.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::readColorBuffer ( const PixelFormat &  pixelType,
Image &  image,
const AABB2i bounds 
) const
pure virtual

Read an image corresponding to the specified contents of the context's current color buffer.

The color buffer is read from and its contents are placed in the output image parameter with the specified pixel type. If the pixel type is incompatible with the framebuffer format, or if the read operation failed, FALSE is returned and no image is retrieved. Otherwise, TRUE is returned and the method succeeds.

This method reads the framebuffer pixels that are in the given bounding box and creates an image with the width and height of the box. Coordinates are specified so that (0,0) is the lower left corner of the context. If the bounding box is outside the range of the framebuffer, it is clamped to the edge of the framebuffer.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::readDepthBuffer ( const PixelFormat &  pixelType,
Image &  image 
) const
pure virtual

Read an image corresponding to the entire contents of the context's current depth buffer.

The depth buffer is read from and its contents are placed in the output image parameter with the specified pixel type. If the pixel type is incompatible with the depthframebuffer format, or if the read operation failed, FALSE is returned and no image is retrieved. Otherwise, TRUE is returned and the method succeeds.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::readDepthBuffer ( const PixelFormat &  pixelType,
Image &  image,
const AABB2i bounds 
) const
pure virtual

Read an image corresponding to the specified contents of the context's current depth buffer.

The depth buffer is read from and its contents are placed in the output image parameter with the specified pixel type. If the pixel type is incompatible with the depth framebuffer format, or if the read operation failed, FALSE is returned and no image is retrieved. Otherwise, TRUE is returned and the method succeeds.

This method reads the framebuffer pixels that are in the given bounding box and creates an image with the width and height of the box. Coordinates are specified so that (0,0) is the lower left corner of the context. If the bounding box is outside the range of the framebuffer, it is clamped to the edge of the framebuffer.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Size2D om::graphics::devices::GraphicsContext::getFramebufferSize ( ) const
pure virtual

Return a 2D vector containing the size in pixels of the currently bound framebuffer.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<Framebuffer> om::graphics::devices::GraphicsContext::getFramebuffer ( ) const
pure virtual

Return a pointer to the currently bound framebuffer object.

A NULL return value indicates that no external framebuffer object is bound to the context and that all drawing commands are being rendered to the main screen (target view).

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::bindFramebuffer ( const Shared< Framebuffer > &  newFramebuffer)
pure virtual

Set the currently bound framebuffer object.

If the specified framebuffer is not valid, the method has no effect and FALSE is returned. Otherwise, the framebuffer binding succeeds, it replaces the previously bound framebuffer, and TRUE is returned.

If a NULL framebuffer pointer is specified, the previously bound framebuffer is unbound and the main target view is bound as the framebuffer instead and TRUE is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual void om::graphics::devices::GraphicsContext::unbindFramebuffer ( )
pure virtual

Unbind the previously bound framebuffer, restoring the main screen as the target.

The previously bound framebuffer is unbound and the main target view is bound as the framebuffer instead and TRUE is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::draw ( const RenderMode renderMode,
const DeviceShaderProgram program,
const ShaderBindingSet shaderBindings,
const ShaderBindingData shaderData,
const IndexRange indexRange,
const IndexBuffer indices = ((void *) 0) 
)
pure virtual

Using the given render mode and shader program, shader bindings, and shader data, draw a range of primitives.

If a non-NULL index buffer is provided, the range corresponds to the index buffer, which provides a level of indirection into the shader binding data vertex buffers. Otherwise, the range corresponds to the vertex buffers that are part of the shader binding data. The method returns whether or not the draw call was successful.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<DeviceBuffer> om::graphics::devices::GraphicsContext::createBuffer ( const BufferType bufferType,
const BufferUsage newUsage = BufferUsage::STATIC 
)
pure virtual

Create a buffer with the specified buffer type with undefined capacity and the given usage.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<DeviceBuffer> om::graphics::devices::GraphicsContext::createBuffer ( const BufferType bufferType,
Size  capacity,
const BufferUsage newUsage = BufferUsage::STATIC 
)
pure virtual

Create a buffer with the specified buffer type, capacity in bytes, and usage.

The contents of the created buffer are undefined.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<DeviceBuffer> om::graphics::devices::GraphicsContext::createBuffer ( const BufferType bufferType,
Size  capacity,
const void *  data,
const BufferUsage newUsage = BufferUsage::STATIC 
)
pure virtual

Create a buffer with the specified buffer type, capacity in bytes, and data source.

This method uses data from the given pointer to initialize the hardware buffer up to the specified capacity.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<DeviceTexture> om::graphics::devices::GraphicsContext::createTexture1D ( TextureFormat  format,
Size  width 
)
pure virtual

Create a 1D texture with the specified internal format and size with undefined pixel data.

If the creation fails, a NULL pointer is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<DeviceTexture> om::graphics::devices::GraphicsContext::createTexture2D ( TextureFormat  format,
Size  width,
Size  height 
)
pure virtual

Create a 2D texture with the specified internal format and size with undefined pixel data.

If the creation fails, a NULL pointer is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<DeviceTexture> om::graphics::devices::GraphicsContext::createTexture3D ( TextureFormat  format,
Size  width,
Size  height,
Size  depth 
)
pure virtual

Create a 3D texture with the specified internal format and size with undefined pixel data.

If the creation fails, a NULL pointer is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<DeviceTexture> om::graphics::devices::GraphicsContext::createTextureCube ( TextureFormat  format,
Size  width 
)
pure virtual

Create a 2D cube map texture with the specified internal format and size with undefined pixel data.

Each face of the cube texture will be the specified size in each dimension.

If the creation fails, a NULL pointer is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

Shared<DeviceTexture> om::graphics::devices::GraphicsContext::createTexture ( const Image &  image)
inline

Create a texture for the specified image which uses an inferred internal texture format.

If the creation fails, a NULL pointer is returned.

virtual Shared<DeviceTexture> om::graphics::devices::GraphicsContext::createTexture ( const Image &  image,
TextureFormat  format 
)
pure virtual

Create a texture for the specified image which has the given internal texture format.

Since an image can have any number of dimensions, this method allows the user to create any-dimension textures with a single interface.

If the creation fails, a NULL pointer is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<DeviceFramebuffer> om::graphics::devices::GraphicsContext::createFramebuffer ( )
pure virtual

Create a new framebuffer object for this context.

If the creation fails, a NULL pointer is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<DeviceShader> om::graphics::devices::GraphicsContext::createShader ( const ShaderType newShaderType,
const ShaderSourceString newSource,
const ShaderLanguage newLanguage = ShaderLanguage::DEFAULT,
StringOutputStream compilationLog = ((void *) 0) 
)
pure virtual

Create and compile a new shader with the specified type and source code.

The shader type is used to influence how the shader's source code is interpreted when compiled. If the shader type or language is unsupported, or if the shader does not succesfully compile, the method fails and NULL is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<DeviceShaderProgram> om::graphics::devices::GraphicsContext::createShaderProgram ( )
pure virtual

Create a new shader program object with no attached shaders.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Shared<DeviceShaderProgram> om::graphics::devices::GraphicsContext::createShaderProgram ( const ShaderProgramSource programSource,
const ShaderConfiguration configuration = ((void *) 0),
StringOutputStream compilationLog = ((void *) 0) 
)
pure virtual

Create a new shader program object that uses the specified shader program source code.

The context uses the source code and configuration in the specified shader program source object to create a new shader program object. The method allows the user to specify additional shader configuration parameters as an optional parameter that override the program source's initial configuration for corresponding parameter usages. If the program compilation or the method fails, a NULL shader program is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual Bool om::graphics::devices::GraphicsContext::getBestProgramSource ( const ShaderProgram shaderProgram,
Index sourceIndex 
) const
pure virtual

Get the index of the best shader program source to use for this context from the given shader program.

If a compatible shader program source code was found in the shader program, the index of that shader program source is placed in the output parameter and TRUE is returned. Otherwise, the context is unable to use the shader program and FALSE is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual const ShaderProgram* om::graphics::devices::GraphicsContext::getDefaultProgram ( const TechniqueUsage usage)
pure virtual

Return a pointer to a default shader pass object for the given technique usage.

The context returns a default shader pass object that renders geometry for the given type of shader pass usage. If the method fails, a NULL shader pass is returned. The user should copy the shader pass and use the copy to render.

Implemented in om::graphics::devices::opengl::OpenGLContext.

virtual const ShaderProgramLibrary* om::graphics::devices::GraphicsContext::getDefaultProgramLibrary ( ) const
pure virtual

Return a pointer to a shader program library that contains default shader programs for the context.

If there is no library, NULL is returned.

Implemented in om::graphics::devices::opengl::OpenGLContext.


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