Interface to drawing graphics. More...
#include <graphic_context.h>
Public Member Functions | |
Construction | |
GraphicContext () | |
Constructs a null instance. More... | |
GraphicContext (GraphicContextProvider *provider) | |
Constructs a GraphicContext. More... | |
~GraphicContext () | |
Attributes | |
bool | is_null () const |
Returns true if this object is invalid. More... | |
void | throw_if_null () const |
Throw an exception if this object is invalid. More... | |
ClipZRange | get_clip_z_range () const |
Returns in what range clip space z values are clipped. More... | |
TextureImageYAxis | get_texture_image_y_axis () const |
Returns the Y axis direction for viewports, clipping rects, textures and render targets. More... | |
ShaderLanguage | get_shader_language () const |
Returns the shader language used. More... | |
int | get_major_version () const |
Returns the major version / feature level supported by the hardware. More... | |
int | get_minor_version () const |
Returns the major version / feature level supported by the hardware. More... | |
bool | has_compute_shader_support () const |
Returns true if the hardware supports compute shaders. More... | |
Texture | get_texture (int index) const |
Returns the currently selected texture for the specified index. More... | |
std::vector< Texture > | get_textures () const |
Returns the currently selected textures. More... | |
FrameBuffer | get_write_frame_buffer () const |
Returns the currently selected write frame buffer. More... | |
FrameBuffer | get_read_frame_buffer () const |
Returns the currently selected read frame buffer. More... | |
int | get_width () const |
Returns the current width of the context. More... | |
int | get_height () const |
Returns the current height of the context. More... | |
Size | get_size () const |
Returns the current size of the context. More... | |
Size | get_max_texture_size () const |
Returns the maximum size of a texture this graphic context supports. More... | |
GraphicContextProvider * | get_provider () |
Returns the provider for this graphic context. More... | |
const GraphicContextProvider *const | get_provider () const |
Operations | |
GraphicContext | create () const |
Create a new default graphic context compatible with this one. More... | |
GraphicContext | create (FrameBuffer &buffer) const |
Create a new default graphic context with a frame buffer selected. More... | |
GraphicContext | clone () const |
Create a new default graphic context cloned with this one. More... | |
PixelBuffer | get_pixeldata (const Rect &rect, TextureFormat texture_format=tf_rgba8, bool clamp=true) |
Return the content of the read buffer into a pixel buffer. More... | |
PixelBuffer | get_pixeldata (TextureFormat texture_format=tf_rgba8, bool clamp=true) |
Return the content of the read buffer into a pixel buffer. More... | |
bool | is_frame_buffer_owner (const FrameBuffer &fb) |
Returns true if this frame buffer object is owned by this graphic context. More... | |
void | set_frame_buffer (const FrameBuffer &write_buffer) |
Sets the current frame buffer. More... | |
void | set_frame_buffer (const FrameBuffer &write_buffer, const FrameBuffer &read_buffer) |
void | reset_frame_buffer () |
Resets the current frame buffer to be the initial frame buffer. More... | |
void | set_uniform_buffer (int index, const UniformBuffer &buffer) |
Select uniform buffer into index. More... | |
void | reset_uniform_buffer (int index) |
Remove uniform buffer from index. More... | |
void | set_storage_buffer (int index, const StorageBuffer &buffer) |
Select storage buffer into index. More... | |
void | reset_storage_buffer (int index) |
Remove storage buffer from index. More... | |
void | set_texture (int unit_index, const Texture &texture) |
Select texture into index. More... | |
void | set_textures (std::vector< Texture > &textures) |
Select textures. More... | |
void | reset_texture (int unit_index) |
Remove texture from index. More... | |
void | reset_textures () |
Remove all selected textures. More... | |
void | set_image_texture (int unit_index, const Texture &texture) |
Select texture image into index. More... | |
void | set_image_texture (std::vector< Texture > &textures) |
Select texture images. More... | |
void | reset_image_texture (int unit_index) |
Remove texture from index. More... | |
void | reset_image_textures () |
Remove all selected textures. More... | |
void | set_rasterizer_state (const RasterizerState &state) |
Set active rasterizer state. More... | |
void | set_blend_state (const BlendState &state, const Colorf &blend_color=Colorf::white, unsigned int sample_mask=0xffffffff) |
Set active blend state. More... | |
void | set_depth_stencil_state (const DepthStencilState &state, int stencil_ref=0) |
Set active depth stencil state. More... | |
void | reset_rasterizer_state () |
Set active rasterizer state. More... | |
void | reset_blend_state () |
Set active blend state. More... | |
void | reset_depth_stencil_state () |
Set active depth stencil state. More... | |
void | set_program_object (StandardProgram standard_program) |
Set active program object to the standard program specified. More... | |
void | set_program_object (const ProgramObject &program) |
Set active program object. More... | |
void | reset_program_object () |
Remove active program object. More... | |
bool | is_primitives_array_owner (const PrimitivesArray &primitives_array) |
Returns true if this primitives array is owned by this graphic context. More... | |
void | draw_primitives (PrimitivesType type, int num_vertices, const PrimitivesArray &array) |
Draw primitives on gc. More... | |
void | set_primitives_array (const PrimitivesArray &array) |
Set the primitives array on the gc. More... | |
void | draw_primitives_array (PrimitivesType type, int num_vertices) |
Draws primitives from the current assigned primitives array. More... | |
void | draw_primitives_array (PrimitivesType type, int offset, int num_vertices) |
Draw primitives array. More... | |
void | draw_primitives_array_instanced (PrimitivesType type, int offset, int num_vertices, int instance_count) |
Draw primitives array instanced. More... | |
void | set_primitives_elements (ElementArrayBuffer &element_array) |
Sets current elements array buffer. More... | |
template<typename Type > | |
void | set_primitives_elements (ElementArrayVector< Type > &element_array) |
Sets current elements array buffer. More... | |
void | draw_primitives_elements (PrimitivesType type, int count, VertexAttributeDataType indices_type, size_t offset=0) |
Draw primitives elements. More... | |
void | draw_primitives_elements_instanced (PrimitivesType type, int count, VertexAttributeDataType indices_type, size_t offset, int instance_count) |
Draw primitives elements instanced. More... | |
void | reset_primitives_elements () |
Resets current elements array buffer. More... | |
void | draw_primitives_elements (PrimitivesType type, int count, ElementArrayBuffer &element_array, VertexAttributeDataType indices_type, size_t offset=0) |
Draw primitives elements. More... | |
void | draw_primitives_elements (PrimitivesType type, int count, ElementArrayVector< unsigned int > &element_array, size_t offset=0) |
Draw primitives elements. More... | |
void | draw_primitives_elements (PrimitivesType type, int count, ElementArrayVector< unsigned short > &element_array, size_t offset=0) |
Draw primitives elements. More... | |
void | draw_primitives_elements (PrimitivesType type, int count, ElementArrayVector< unsigned char > &element_array, size_t offset=0) |
Draw primitives elements. More... | |
void | draw_primitives_elements_instanced (PrimitivesType type, int count, ElementArrayBuffer &element_array, VertexAttributeDataType indices_type, size_t offset, int instance_count) |
Draw primitives elements instanced. More... | |
void | draw_primitives_elements_instanced (PrimitivesType type, int count, ElementArrayVector< unsigned int > &element_array, size_t offset, int instance_count) |
Draw primitives elements instanced. More... | |
void | draw_primitives_elements_instanced (PrimitivesType type, int count, ElementArrayVector< unsigned short > &element_array, size_t offset, int instance_count) |
Draw primitives elements instanced. More... | |
void | draw_primitives_elements_instanced (PrimitivesType type, int count, ElementArrayVector< unsigned char > &element_array, size_t offset, int instance_count) |
Draw primitives elements instanced. More... | |
void | reset_primitives_array () |
Reset the primitives arrays. More... | |
void | dispatch (int x=1, int y=1, int z=1) |
Execute a compute shader. More... | |
void | clear (const Colorf &color=Colorf::black) |
Clears the whole context using the specified color. More... | |
void | clear_stencil (int value=0) |
Clear the stencil buffer. More... | |
void | clear_depth (float value=0) |
Clear the depth buffer. More... | |
void | set_scissor (const Rect &rect, TextureImageYAxis y_axis) |
Set the current clipping rectangle. More... | |
void | reset_scissor () |
Removes the set clipping rectangle. More... | |
void | set_viewport (const Rectf &viewport) |
Set the viewport to be used in user projection map mode. More... | |
void | set_viewport (int index, const Rectf &viewport) |
Set the specified viewport to be used in user projection map mode. More... | |
void | set_depth_range (float n, float f) |
Specifies the depth range for all viewports. More... | |
void | set_depth_range (int viewport, float n, float f) |
Specifies the depth range for the specified viewport. More... | |
void | set_draw_buffer (DrawBuffer buffer) |
Set used draw buffer. More... | |
Operators | |
bool | operator== (const GraphicContext &other) const |
bool | operator!= (const GraphicContext &other) const |
Implementation | |
class | OpenGL |
Interface to drawing graphics.