Interface to drawing graphics. More...
#include <graphic_context.h>
Public Member Functions | |
virtual void | clear (const Colorf &color=Colorf::black)=0 |
Clears the whole context using the specified color. More... | |
virtual void | clear_depth (float value=0)=0 |
virtual void | clear_stencil (int value=0)=0 |
virtual ClipZRange | clip_z_range () const =0 |
Returns in what range clip space z values are clipped. More... | |
virtual std::shared_ptr< BlendState > | create_blend_state (const BlendStateDescription &desc)=0 |
Create blend state object. More... | |
virtual std::shared_ptr< DepthStencilState > | create_depth_stencil_state (const DepthStencilStateDescription &desc)=0 |
Create depth-stencil state object. More... | |
virtual std::shared_ptr< RasterizerState > | create_rasterizer_state (const RasterizerStateDescription &desc)=0 |
Create rasterizer state object. More... | |
float | dip_height () const |
Sizef | dip_size () const |
float | dip_width () const |
virtual void | dispatch (int x=1, int y=1, int z=1)=0 |
Execute a compute shader. More... | |
virtual void | draw_primitives (PrimitivesType type, int num_vertices, const PrimitivesArrayPtr &array)=0 |
Draw primitives on gc. More... | |
void | draw_primitives_array (PrimitivesType type, int num_vertices) |
Draws primitives from the current assigned primitives array. More... | |
virtual void | draw_primitives_array (PrimitivesType type, int offset, int num_vertices)=0 |
virtual void | draw_primitives_array_instanced (PrimitivesType type, int offset, int num_vertices, int instance_count)=0 |
virtual void | draw_primitives_elements (PrimitivesType type, int count, VertexAttributeDataType indices_type, size_t offset=0)=0 |
virtual void | draw_primitives_elements (PrimitivesType type, int count, const ElementArrayBufferPtr &element_array, VertexAttributeDataType indices_type, size_t offset=0)=0 |
virtual void | draw_primitives_elements_instanced (PrimitivesType type, int count, VertexAttributeDataType indices_type, size_t offset, int instance_count)=0 |
virtual void | draw_primitives_elements_instanced (PrimitivesType type, int count, const ElementArrayBufferPtr &element_array, VertexAttributeDataType indices_type, size_t offset, int instance_count)=0 |
virtual void | flush ()=0 |
Flush the command buffer. More... | |
virtual bool | has_compute_shader_support () const =0 |
int | height () const |
Returns the current actual height of the context. More... | |
virtual bool | is_frame_buffer_owner (const FrameBufferPtr &fb)=0 |
virtual bool | is_primitives_array_owner (const PrimitivesArrayPtr &primitives_array)=0 |
virtual int | major_version () const =0 |
virtual Size | max_texture_size () const =0 |
virtual int | minor_version () const =0 |
virtual float | pixel_ratio () const =0 |
virtual PixelBufferPtr | pixeldata (const Rect &rect, TextureFormat texture_format=tf_rgba8, bool clamp=true) const =0 |
Return the content of the read buffer into a pixel buffer. More... | |
PixelBufferPtr | pixeldata (TextureFormat texture_format=tf_rgba8, bool clamp=true) |
Return the content of the read buffer into a pixel buffer. More... | |
virtual ProgramObjectPtr | program_object () const =0 |
Returns the currently selected program object. More... | |
virtual FrameBufferPtr | read_frame_buffer () const =0 |
void | reset_blend_state () |
Set active blend state. More... | |
void | reset_depth_stencil_state () |
Set active depth stencil state. More... | |
void | reset_frame_buffer () |
Resets the current frame buffer to be the initial frame buffer. More... | |
void | reset_image_texture (int unit_index) |
void | reset_image_textures (int start_index, size_t count) |
Remove all selected textures. More... | |
void | reset_primitives_array () |
Reset the primitives arrays. More... | |
void | reset_primitives_elements () |
Resets current elements array buffer. More... | |
void | reset_program_object () |
Remove active program object. More... | |
void | reset_rasterizer_state () |
Set active rasterizer state. More... | |
virtual void | reset_scissor ()=0 |
Removes the set clipping rectangle. More... | |
void | reset_storage_buffer (int index) |
Remove storage buffer from index. More... | |
void | reset_texture (int unit_index) |
void | reset_textures (int start_index, size_t count) |
Remove all selected textures. More... | |
void | reset_uniform_buffer (int index) |
Remove uniform buffer from index. More... | |
virtual void | set_blend_state (const BlendStatePtr &state, const Colorf &blend_color=Colorf::white, unsigned int sample_mask=0xffffffff)=0 |
Set active blend state. More... | |
void | set_depth_range (float n, float f) |
Specifies the depth range for all viewports. More... | |
virtual void | set_depth_range (int viewport, float n, float f)=0 |
Specifies the depth range for the specified viewport. More... | |
virtual void | set_depth_stencil_state (const DepthStencilStatePtr &state, int stencil_ref=0)=0 |
Set active depth stencil state. More... | |
virtual void | set_draw_buffer (DrawBuffer buffer)=0 |
Set used draw buffer. More... | |
void | set_frame_buffer (const FrameBufferPtr &write_buffer) |
Sets the current frame buffer. More... | |
virtual void | set_frame_buffer (const FrameBufferPtr &write_buffer, const FrameBufferPtr &read_buffer)=0 |
virtual void | set_image_texture (int unit_index, const TexturePtr &texture)=0 |
void | set_image_textures (const std::vector< TexturePtr > &textures) |
void | set_image_textures (int start_index, const std::vector< TexturePtr > &textures) |
virtual void | set_primitives_array (const PrimitivesArrayPtr &array)=0 |
Set the primitives array on the gc. More... | |
virtual void | set_primitives_elements (const ElementArrayBufferPtr &element_array)=0 |
Sets current elements array buffer. More... | |
virtual void | set_program_object (StandardProgram standard_program)=0 |
Set active program object to the standard program specified. More... | |
virtual void | set_program_object (const ProgramObjectPtr &program)=0 |
Set active program object. More... | |
virtual void | set_rasterizer_state (const RasterizerStatePtr &state)=0 |
Set active rasterizer state. More... | |
virtual void | set_scissor (const Rect &rect, TextureImageYAxis y_axis)=0 |
Set the current clipping rectangle. More... | |
virtual void | set_storage_buffer (int index, const StorageBufferPtr &buffer)=0 |
Select storage buffer into index. More... | |
virtual void | set_texture (int unit_index, const TexturePtr &texture)=0 |
void | set_textures (const std::vector< TexturePtr > &textures) |
void | set_textures (int start_index, const std::vector< TexturePtr > &textures) |
virtual void | set_uniform_buffer (int index, const UniformBufferPtr &buffer)=0 |
Select uniform buffer into index. More... | |
virtual void | set_viewport (const Rectf &viewport, TextureImageYAxis y_axis)=0 |
virtual void | set_viewport (int index, const Rectf &viewport, TextureImageYAxis y_axis)=0 |
virtual ShaderLanguage | shader_language () const =0 |
Returns the shader language used. More... | |
virtual Size | size () const =0 |
Returns the current actual size of the context. More... | |
virtual TextureImageYAxis | texture_image_y_axis () const =0 |
Returns the Y axis direction for viewports, clipping rects, textures and render targets. More... | |
int | width () const |
Returns the current actual width of the context. More... | |
virtual FrameBufferPtr | write_frame_buffer () const =0 |
Interface to drawing graphics.
|
pure virtual |
Clears the whole context using the specified color.
|
pure virtual |
Clear the depth buffer
value | value to clear to. Range 0.0 - 1.0. |
|
pure virtual |
Clear the stencil buffer
value | value to clear to. |
|
pure virtual |
Returns in what range clip space z values are clipped.
|
pure virtual |
Create blend state object.
|
pure virtual |
Create depth-stencil state object.
|
pure virtual |
Create rasterizer state object.
|
inline |
Calculates the device independent height of the context. Resolution Independence
References height(), and pixel_ratio().
Referenced by dip_size().
|
inline |
Calculates the device independent dimensions of the context. Resolution Independence
References dip_height(), and dip_width().
|
inline |
Calculates the device independent width of the context. Resolution Independence
References pixel_ratio(), and width().
Referenced by dip_size().
|
pure virtual |
Execute a compute shader.
|
pure virtual |
Draw primitives on gc.
|
inline |
Draws primitives from the current assigned primitives array.
References draw_primitives_array().
Referenced by draw_primitives_array().
|
pure virtual |
Draw primitives array
type | = Primitives Type |
offset | = value |
num_vertices | = value |
|
pure virtual |
Draw primitives array instanced
type | = Primitives Type |
offset | = value |
num_vertices | = value |
instance_count | = number of instances drawn |
|
pure virtual |
Draw primitives elements
type | = Primitives Type |
count | = value |
indices_type | = Vertex Attribute Data Type |
offset | = void |
|
pure virtual |
Draw primitives elements
type | = Primitives Type |
count | = value |
element_array | = Element Array Buffer |
indices_type | = Vertex Attribute Data Type |
offset | = void |
|
pure virtual |
Draw primitives elements instanced
type | = Primitives Type |
count | = value |
indices_type | = Vertex Attribute Data Type |
offset | = void |
instance_count | = number of instances drawn |
|
pure virtual |
Draw primitives elements instanced
type | = Primitives Type |
count | = value |
element_array | = Element Array Buffer |
indices_type | = Vertex Attribute Data Type |
offset | = void |
instance_count | = number of instances drawn |
|
pure virtual |
Flush the command buffer.
|
pure virtual |
Returns true
if the hardware supports compute shaders. This function will always returns true for OpenGL 4.3 or newer, or Direct3D 11.0 or newer. For Direct3D 10.0 and 10.1, the support for compute shaders is optional.
|
inline |
Returns the current actual height of the context.
References uicore::Sizex< Type >::height, and size().
Referenced by dip_height().
|
pure virtual |
Returns true
if this frame buffer object is owned by this graphic context.
Frame buffer objects cannot be shared between graphic contexts. This function will verify if the frame buffer object belongs to this graphic context.
|
pure virtual |
Returns true if this primitives array is owned by this graphic context.
Primitive array objects cannot be shared between graphic contexts. This function verifies that the primitives array belongs to this graphic context.
|
pure virtual |
|
pure virtual |
Retrieves the maximum size for a texture that this graphic context will allow. Size(0, 0) will be returned if there is no known limitation to the maximum texture size allowed for the context.
|
pure virtual |
|
pure virtual |
Retrieves the display pixel ratio of the context. Resolution Independence
Referenced by dip_height(), and dip_width().
|
pure virtual |
Return the content of the read buffer into a pixel buffer.
|
inline |
Return the content of the read buffer into a pixel buffer.
References uicore::clamp, pixeldata(), and size().
Referenced by pixeldata().
|
pure virtual |
Returns the currently selected program object.
|
pure virtual |
Returns the currently selected read frame buffer.
|
inline |
Set active blend state.
References set_blend_state().
|
inline |
Set active depth stencil state.
References set_depth_stencil_state().
|
inline |
Resets the current frame buffer to be the initial frame buffer.
References set_frame_buffer().
|
inline |
Remove texture from index.
unit_index | = 0 to x, the index of the texture |
References set_image_texture().
|
inline |
Remove all selected textures.
References uicore::i, and set_image_texture().
|
inline |
Reset the primitives arrays.
References set_primitives_array().
|
inline |
Resets current elements array buffer.
References set_primitives_elements().
|
inline |
Remove active program object.
References set_program_object().
|
inline |
Set active rasterizer state.
References set_rasterizer_state().
|
pure virtual |
Removes the set clipping rectangle.
|
inline |
Remove storage buffer from index.
References set_storage_buffer().
|
inline |
Remove texture from index.
unit_index | = 0 to x, the index of the texture |
References set_texture().
|
inline |
Remove all selected textures.
References uicore::i, and set_texture().
|
inline |
Remove uniform buffer from index.
References set_uniform_buffer().
|
pure virtual |
Set active blend state.
Referenced by reset_blend_state().
|
inline |
Specifies the depth range for all viewports.
References set_depth_range().
Referenced by set_depth_range().
|
pure virtual |
Specifies the depth range for the specified viewport.
|
pure virtual |
Set active depth stencil state.
Referenced by reset_depth_stencil_state().
|
pure virtual |
Set used draw buffer.
|
inline |
Sets the current frame buffer.
References set_frame_buffer().
Referenced by reset_frame_buffer(), and set_frame_buffer().
|
pure virtual |
|
pure virtual |
Select texture image into index.
unit_index | = 0 to x, the index of this texture |
texture | = The texture to select. This can be a null texture to clear that unit |
Referenced by reset_image_texture(), reset_image_textures(), and set_image_textures().
|
inline |
Select texture images
Only textures units from 0 to textures.size()-1 are set.
textures | = The texture to select. These may contain null textures |
start_index | = First unit to select the textures into |
References set_image_textures().
Referenced by set_image_textures().
|
inline |
References uicore::i, and set_image_texture().
|
pure virtual |
Set the primitives array on the gc.
Referenced by reset_primitives_array().
|
pure virtual |
Sets current elements array buffer.
Referenced by reset_primitives_elements().
|
pure virtual |
Set active program object to the standard program specified.
Referenced by reset_program_object().
|
pure virtual |
Set active program object.
|
pure virtual |
Set active rasterizer state.
Referenced by reset_rasterizer_state().
|
pure virtual |
Set the current clipping rectangle.
|
pure virtual |
Select storage buffer into index.
Referenced by reset_storage_buffer().
|
pure virtual |
Select texture into index.
unit_index | = 0 to x, the index of this texture |
texture | = The texture to select. This can be a null texture to clear that unit |
Referenced by reset_texture(), reset_textures(), and set_textures().
|
inline |
Select textures
start_index | = First unit to select the textures into |
textures | = The textures to select. These may contain null textures |
References set_textures().
Referenced by set_textures().
|
inline |
References uicore::i, and set_texture().
|
pure virtual |
Select uniform buffer into index.
Referenced by reset_uniform_buffer().
|
pure virtual |
Set the viewport to be used in user projection map mode.
viewport | = The viewport to set |
|
pure virtual |
Set the specified viewport to be used in user projection map mode.
index | = The viewport index (0 to x) |
viewport | = The viewport to set |
|
pure virtual |
Returns the shader language used.
|
pure virtual |
Returns the current actual size of the context.
Referenced by height(), pixeldata(), and width().
|
pure virtual |
Returns the Y axis direction for viewports, clipping rects, textures and render targets.
|
inline |
Returns the current actual width of the context.
References size(), and uicore::Sizex< Type >::width.
Referenced by dip_width().
|
pure virtual |
Returns the currently selected write frame buffer.