Om
1.0.0
A universal framework for multimedia simulation
|
A class that represents an instance of an OpenGL-based renderer. More...
#include <omGraphicsOpenGLContext.h>
Public Member Functions | |
~OpenGLContext () | |
Destroy this OpenGL context and release all of its resources and internal state. More... | |
virtual Bool | addView (gui::RenderView *newView) |
Add a new target view to this context that it should render to. More... | |
virtual Bool | removeView (const gui::RenderView *newView) |
Remove a previous view from this context so that it cannot be rendered to anymore. More... | |
virtual void | clearViews () |
Remove all previously associated views from this context. More... | |
virtual gui::RenderView * | getTargetView () const |
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) |
Set the target view that this context should render to. More... | |
virtual Bool | isValid () const |
Return whether or not this context is valid and can be used for rendering. More... | |
virtual const GraphicsContextCapabilities & | getCapabilities () const |
Return an object that describes the different capabilities of this graphics context. More... | |
virtual Bool | isCurrent () |
Return whether or not this context is the current context for the calling thread. More... | |
virtual Bool | makeCurrent () |
Make this context the active context for the calling thread. More... | |
virtual Bool | swapBuffers () |
Flush all rendering commands and swap the front buffer with the back buffer. More... | |
virtual Bool | getVSync () const |
Return whether or not vertical screen refresh synchronization is enabled. More... | |
virtual Bool | setVSync (Bool newVSync) |
Set whether or not vertical screen refresh synchronization should be enabled. More... | |
virtual void | flush () |
Flush all rendering commands into the graphics pipeline. More... | |
virtual void | finish () |
Flush all rendering commands into the graphics pipeline and wait until they are complete. More... | |
virtual RenderMode | getRenderMode () const |
Return an object that contains information about the current state of the context's renderer. More... | |
virtual Bool | setRenderMode (const RenderMode &newRenderMode) |
Set the mode of the context's renderer. More... | |
virtual RenderFlags | getRenderFlags () const |
Return an object that contains boolan flags for the current state of the context's renderer. More... | |
virtual Bool | setRenderFlags (const RenderFlags &newRenderFlags) |
Set an object that contains boolan flags for the current state of the context's renderer. More... | |
virtual Bool | getRenderFlagIsSet (RenderFlags::Flag flag) const |
Return whether or not a certain render flag is currently set. More... | |
virtual Bool | setRenderFlag (RenderFlags::Flag flag, Bool value=true) |
Set whether or not a certain render flag should be set. More... | |
virtual DepthMode | getDepthMode () const |
Return an object that contains information about the current state of the context's depth test pipeline. More... | |
virtual Bool | setDepthMode (const DepthMode &newDepthMode) |
Set the mode of the context's depth test pipeline. More... | |
virtual StencilMode | getStencilMode () const |
Return an object that contains information about the current state of the context's stencil test pipeline. More... | |
virtual Bool | setStencilMode (const StencilMode &newStencilMode) |
Set the mode of the context's stencil test pipeline. More... | |
virtual BlendMode | getBlendMode () const |
Return an object that contains information about the current state of the context's blending pipeline. More... | |
virtual Bool | setBlendMode (const BlendMode &newBlendMode) |
Set the mode of the context's blending pipeline. More... | |
virtual Float | getLineWidth () const |
Return the width in pixels to use when rendering lines. More... | |
virtual Bool | setLineWidth (Float newLineWidth) |
Set the width in pixels to use when rendering lines. More... | |
virtual Float | getPointSize () const |
Return the size in pixels to use when rendering points. More... | |
virtual Bool | setPointSize (Float newPointSize) |
Set the size in pixels to use when rendering points. More... | |
virtual Viewport | getViewport () const |
Return an object representing the current viewport for this OpenGL context. More... | |
virtual Bool | setViewport (const Viewport &newViewport) |
Set the viewport to use for this OpenGL context. More... | |
virtual ScissorTest | getScissorTest () const |
Return an object representing the current scissor test for this graphics context. More... | |
virtual Bool | setScissorTest (const ScissorTest &newScissorTest) |
Set an object representing the current scissor test for this graphics context. More... | |
virtual void | clearColorBuffer (const Color4d &clearColor) |
Clear the contents of the color buffer, writing the specified color to every pixel. More... | |
virtual void | clearDepthBuffer (Double clearDepth) |
Clear the contents of the depth buffer, writing the specified depth to every pixel. More... | |
virtual void | clearStencilBuffer (Int clearStencil) |
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 |
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 |
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 |
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 |
Read an image corresponding to the specified contents of the context's current depth buffer. More... | |
virtual Size2D | getFramebufferSize () const |
Return a 2D vector containing the size in pixels of the currently bound framebuffer. More... | |
virtual Shared< Framebuffer > | getFramebuffer () const |
Return a pointer to the currently bound framebuffer object. More... | |
virtual Bool | bindFramebuffer (const Shared< Framebuffer > &newFramebuffer) |
Set the currently bound framebuffer object. More... | |
virtual void | unbindFramebuffer () |
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)) |
Using the given render mode and shader program, shader bindings, and shader data, draw a range of primitives. More... | |
virtual Shared< DeviceBuffer > | createBuffer (const BufferType &bufferType, const BufferUsage &newUsage=BufferUsage::STATIC) |
Create a buffer with the specified buffer type with undefined capacity and the given usage. More... | |
virtual Shared< DeviceBuffer > | createBuffer (const BufferType &bufferType, Size capacity, const BufferUsage &newUsage=BufferUsage::STATIC) |
Create a buffer with the specified buffer type, capacity in bytes, and usage. More... | |
virtual Shared< DeviceBuffer > | createBuffer (const BufferType &bufferType, Size capacity, const void *data, const BufferUsage &newUsage=BufferUsage::STATIC) |
Create a buffer with the specified buffer type, capacity in bytes, and data source. More... | |
virtual Shared< DeviceTexture > | createTexture1D (TextureFormat format, Size width) |
Create a 1D texture with the specified internal format and size with undefined pixel data. More... | |
virtual Shared< DeviceTexture > | createTexture2D (TextureFormat format, Size width, Size height) |
Create a 2D texture with the specified internal format and size with undefined pixel data. More... | |
virtual Shared< DeviceTexture > | createTexture3D (TextureFormat format, Size width, Size height, Size depth) |
Create a 3D texture with the specified internal format and size with undefined pixel data. More... | |
virtual Shared< DeviceTexture > | createTextureCube (TextureFormat format, Size width) |
Create a 2D cube map texture with the specified internal format and size with undefined pixel data. More... | |
virtual Shared< DeviceTexture > | createTexture (const Image &image, TextureFormat format) |
Create a texture for the specified image which has the given internal texture format. More... | |
virtual Shared< DeviceFramebuffer > | createFramebuffer () |
Create a new framebuffer object for this context. More... | |
virtual Shared< DeviceShader > | createShader (const ShaderType &newShaderType, const ShaderSourceString &newSource, const ShaderLanguage &newLanguage=ShaderLanguage::DEFAULT, StringOutputStream *compilationLog=((void *) 0)) |
Create and compile a new shader with the specified type and source code. More... | |
virtual Shared< DeviceShaderProgram > | createShaderProgram () |
Create a new shader program object with no attached shaders. More... | |
virtual Shared< DeviceShaderProgram > | createShaderProgram (const ShaderProgramSource &programSource, const ShaderConfiguration *configuration=((void *) 0), StringOutputStream *compilationLog=((void *) 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 |
Get the index of the best shader program source to use for this context from the given shader program. More... | |
virtual const ShaderProgram * | getDefaultProgram (const TechniqueUsage &usage) |
Return a pointer to a default shader pass object for the given technique usage. More... | |
virtual const ShaderProgramLibrary * | getDefaultProgramLibrary () const |
Return a pointer to a shader program library that contains default shader programs for the context. More... | |
Public Member Functions inherited from om::graphics::devices::GraphicsContext | |
virtual | ~GraphicsContext () |
Destroy a graphics context, releasing all of its resources and internal state. More... | |
Bool | hasCapabilities (const GraphicsContextCapabilities &capabilities) |
Return whether or not this graphics context supports the specified capabilities. More... | |
Size2D | getViewportSize () const |
Return a 2D vector containing the size in framebuffer pixels of the current viewport. More... | |
Shared< DeviceTexture > | createTexture (const Image &image) |
Create a texture for the specified image which uses an inferred internal texture format. More... | |
A class that represents an instance of an OpenGL-based renderer.
om::graphics::devices::opengl::OpenGLContext::~OpenGLContext | ( | ) |
Destroy this OpenGL context and release all of its resources and internal state.
|
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.
Implements om::graphics::devices::GraphicsContext.
|
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.
Implements om::graphics::devices::GraphicsContext.
|
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.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return a pointer to the target render view at the given index that this context can render to.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set the target view that this context should render to.
Implements om::graphics::devices::GraphicsContext.
|
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.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return an object that describes the different capabilities of this graphics context.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return whether or not this context is the current context for the calling thread.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Make this context the active context for the calling thread.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Flush all rendering commands and swap the front buffer with the back buffer.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return whether or not vertical screen refresh synchronization is enabled.
Implements om::graphics::devices::GraphicsContext.
Set whether or not vertical screen refresh synchronization should be enabled.
The method returns whether or not setting the V-Sync status was successful.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Flush all rendering commands into the graphics pipeline.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Flush all rendering commands into the graphics pipeline and wait until they are complete.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return an object that contains information about the current state of the context's renderer.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set the mode of the context's renderer.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return an object that contains boolan flags for the current state of the context's renderer.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set an object that contains boolan flags for the current state of the context's renderer.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return whether or not a certain render flag is currently set.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set whether or not a certain render flag should be set.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return an object that contains information about the current state of the context's depth test pipeline.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set the mode of the context's depth test pipeline.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return an object that contains information about the current state of the context's stencil test pipeline.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set the mode of the context's stencil test pipeline.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return an object that contains information about the current state of the context's blending pipeline.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set the mode of the context's blending pipeline.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return the width in pixels to use when rendering lines.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set the width in pixels to use when rendering lines.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return the size in pixels to use when rendering points.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set the size in pixels to use when rendering points.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return an object representing the current viewport for this OpenGL context.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set the viewport to use for this OpenGL context.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return an object representing the current scissor test for this graphics context.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set an object representing the current scissor test for this graphics context.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Clear the contents of the color buffer, writing the specified color to every pixel.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Clear the contents of the depth buffer, writing the specified depth to every pixel.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Clear the contents of the stencil buffer, writing the specified integer value to every pixel.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Read an image corresponding to the entire contents of the context's current color buffer.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Read an image corresponding to the specified contents of the context's current color buffer.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Read an image corresponding to the entire contents of the context's current depth buffer.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Read an image corresponding to the specified contents of the context's current depth buffer.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return a 2D vector containing the size in pixels of the currently bound framebuffer.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return a pointer to the currently bound framebuffer object.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Set the currently bound framebuffer object.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Unbind the previously bound framebuffer, restoring the main screen as the target.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Using the given render mode and shader program, shader bindings, and shader data, draw a range of primitives.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Create a buffer with the specified buffer type with undefined capacity and the given usage.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Create a buffer with the specified buffer type, capacity in bytes, and usage.
The contents of the created buffer are undefined.
Implements om::graphics::devices::GraphicsContext.
|
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.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Create a 1D texture with the specified internal format and size with undefined pixel data.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Create a 2D texture with the specified internal format and size with undefined pixel data.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Create a 3D texture with the specified internal format and size with undefined pixel data.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Create a 2D cube map texture with the specified internal format and size with undefined pixel data.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Create a texture for the specified image which has the given internal texture format.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Create a new framebuffer object for this context.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Create and compile a new shader with the specified type and source code.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Create a new shader program object with no attached shaders.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Create a new shader program object that uses the specified shader program source code.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Get the index of the best shader program source to use for this context from the given shader program.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return a pointer to a default shader pass object for the given technique usage.
Implements om::graphics::devices::GraphicsContext.
|
virtual |
Return a pointer to a shader program library that contains default shader programs for the context.
Implements om::graphics::devices::GraphicsContext.