uicore::GraphicContext Class Referenceabstract

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< BlendStatecreate_blend_state (const BlendStateDescription &desc)=0
 Create blend state object. More...
 
virtual std::shared_ptr< DepthStencilStatecreate_depth_stencil_state (const DepthStencilStateDescription &desc)=0
 Create depth-stencil state object. More...
 
virtual std::shared_ptr< RasterizerStatecreate_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
 

Detailed Description

Interface to drawing graphics.

Member Function Documentation

virtual void uicore::GraphicContext::clear ( const Colorf color = Colorf::black)
pure virtual

Clears the whole context using the specified color.

virtual void uicore::GraphicContext::clear_depth ( float  value = 0)
pure virtual

Clear the depth buffer

Parameters
valuevalue to clear to. Range 0.0 - 1.0.
virtual void uicore::GraphicContext::clear_stencil ( int  value = 0)
pure virtual

Clear the stencil buffer

Parameters
valuevalue to clear to.
virtual ClipZRange uicore::GraphicContext::clip_z_range ( ) const
pure virtual

Returns in what range clip space z values are clipped.

virtual std::shared_ptr<BlendState> uicore::GraphicContext::create_blend_state ( const BlendStateDescription desc)
pure virtual

Create blend state object.

virtual std::shared_ptr<DepthStencilState> uicore::GraphicContext::create_depth_stencil_state ( const DepthStencilStateDescription desc)
pure virtual

Create depth-stencil state object.

virtual std::shared_ptr<RasterizerState> uicore::GraphicContext::create_rasterizer_state ( const RasterizerStateDescription desc)
pure virtual

Create rasterizer state object.

float uicore::GraphicContext::dip_height ( ) const
inline

Calculates the device independent height of the context. Resolution Independence

References height(), and pixel_ratio().

Referenced by dip_size().

Sizef uicore::GraphicContext::dip_size ( ) const
inline

Calculates the device independent dimensions of the context. Resolution Independence

References dip_height(), and dip_width().

float uicore::GraphicContext::dip_width ( ) const
inline

Calculates the device independent width of the context. Resolution Independence

References pixel_ratio(), and width().

Referenced by dip_size().

virtual void uicore::GraphicContext::dispatch ( int  x = 1,
int  y = 1,
int  z = 1 
)
pure virtual

Execute a compute shader.

virtual void uicore::GraphicContext::draw_primitives ( PrimitivesType  type,
int  num_vertices,
const PrimitivesArrayPtr array 
)
pure virtual

Draw primitives on gc.

void uicore::GraphicContext::draw_primitives_array ( PrimitivesType  type,
int  num_vertices 
)
inline

Draws primitives from the current assigned primitives array.

References draw_primitives_array().

Referenced by draw_primitives_array().

virtual void uicore::GraphicContext::draw_primitives_array ( PrimitivesType  type,
int  offset,
int  num_vertices 
)
pure virtual

Draw primitives array

Parameters
type= Primitives Type
offset= value
num_vertices= value
virtual void uicore::GraphicContext::draw_primitives_array_instanced ( PrimitivesType  type,
int  offset,
int  num_vertices,
int  instance_count 
)
pure virtual

Draw primitives array instanced

Parameters
type= Primitives Type
offset= value
num_vertices= value
instance_count= number of instances drawn
virtual void uicore::GraphicContext::draw_primitives_elements ( PrimitivesType  type,
int  count,
VertexAttributeDataType  indices_type,
size_t  offset = 0 
)
pure virtual

Draw primitives elements

Parameters
type= Primitives Type
count= value
indices_type= Vertex Attribute Data Type
offset= void
virtual void uicore::GraphicContext::draw_primitives_elements ( PrimitivesType  type,
int  count,
const ElementArrayBufferPtr element_array,
VertexAttributeDataType  indices_type,
size_t  offset = 0 
)
pure virtual

Draw primitives elements

Parameters
type= Primitives Type
count= value
element_array= Element Array Buffer
indices_type= Vertex Attribute Data Type
offset= void
virtual void uicore::GraphicContext::draw_primitives_elements_instanced ( PrimitivesType  type,
int  count,
VertexAttributeDataType  indices_type,
size_t  offset,
int  instance_count 
)
pure virtual

Draw primitives elements instanced

Parameters
type= Primitives Type
count= value
indices_type= Vertex Attribute Data Type
offset= void
instance_count= number of instances drawn
virtual void uicore::GraphicContext::draw_primitives_elements_instanced ( PrimitivesType  type,
int  count,
const ElementArrayBufferPtr element_array,
VertexAttributeDataType  indices_type,
size_t  offset,
int  instance_count 
)
pure virtual

Draw primitives elements instanced

Parameters
type= Primitives Type
count= value
element_array= Element Array Buffer
indices_type= Vertex Attribute Data Type
offset= void
instance_count= number of instances drawn
virtual void uicore::GraphicContext::flush ( )
pure virtual

Flush the command buffer.

virtual bool uicore::GraphicContext::has_compute_shader_support ( ) const
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.

int uicore::GraphicContext::height ( ) const
inline

Returns the current actual height of the context.

References uicore::Sizex< Type >::height, and size().

Referenced by dip_height().

virtual bool uicore::GraphicContext::is_frame_buffer_owner ( const FrameBufferPtr fb)
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.

virtual bool uicore::GraphicContext::is_primitives_array_owner ( const PrimitivesArrayPtr primitives_array)
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.

virtual int uicore::GraphicContext::major_version ( ) const
pure virtual

Returns the major version / feature level supported by the hardware. For an OpenGL target, this returns the major OpenGL version the driver supports. For a Direct3D target, this returns the major feature level.

virtual Size uicore::GraphicContext::max_texture_size ( ) const
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.

virtual int uicore::GraphicContext::minor_version ( ) const
pure virtual

Returns the minor version / feature level supported by the hardware. For an OpenGL target, this returns the minor OpenGL version the driver supports. For a Direct3D target, this returns the minor feature level.

virtual float uicore::GraphicContext::pixel_ratio ( ) const
pure virtual

Retrieves the display pixel ratio of the context. Resolution Independence

Referenced by dip_height(), and dip_width().

virtual PixelBufferPtr uicore::GraphicContext::pixeldata ( const Rect rect,
TextureFormat  texture_format = tf_rgba8,
bool  clamp = true 
) const
pure virtual

Return the content of the read buffer into a pixel buffer.

PixelBufferPtr uicore::GraphicContext::pixeldata ( TextureFormat  texture_format = tf_rgba8,
bool  clamp = true 
)
inline

Return the content of the read buffer into a pixel buffer.

References uicore::clamp, pixeldata(), and size().

Referenced by pixeldata().

virtual ProgramObjectPtr uicore::GraphicContext::program_object ( ) const
pure virtual

Returns the currently selected program object.

virtual FrameBufferPtr uicore::GraphicContext::read_frame_buffer ( ) const
pure virtual

Returns the currently selected read frame buffer.

Returns
The frame buffer.
void uicore::GraphicContext::reset_blend_state ( )
inline

Set active blend state.

References set_blend_state().

void uicore::GraphicContext::reset_depth_stencil_state ( )
inline

Set active depth stencil state.

References set_depth_stencil_state().

void uicore::GraphicContext::reset_frame_buffer ( )
inline

Resets the current frame buffer to be the initial frame buffer.

References set_frame_buffer().

void uicore::GraphicContext::reset_image_texture ( int  unit_index)
inline

Remove texture from index.

Parameters
unit_index= 0 to x, the index of the texture

References set_image_texture().

void uicore::GraphicContext::reset_image_textures ( int  start_index,
size_t  count 
)
inline

Remove all selected textures.

References uicore::i, and set_image_texture().

void uicore::GraphicContext::reset_primitives_array ( )
inline

Reset the primitives arrays.

References set_primitives_array().

void uicore::GraphicContext::reset_primitives_elements ( )
inline

Resets current elements array buffer.

References set_primitives_elements().

void uicore::GraphicContext::reset_program_object ( )
inline

Remove active program object.

References set_program_object().

void uicore::GraphicContext::reset_rasterizer_state ( )
inline

Set active rasterizer state.

References set_rasterizer_state().

virtual void uicore::GraphicContext::reset_scissor ( )
pure virtual

Removes the set clipping rectangle.

void uicore::GraphicContext::reset_storage_buffer ( int  index)
inline

Remove storage buffer from index.

References set_storage_buffer().

void uicore::GraphicContext::reset_texture ( int  unit_index)
inline

Remove texture from index.

Parameters
unit_index= 0 to x, the index of the texture

References set_texture().

void uicore::GraphicContext::reset_textures ( int  start_index,
size_t  count 
)
inline

Remove all selected textures.

References uicore::i, and set_texture().

void uicore::GraphicContext::reset_uniform_buffer ( int  index)
inline

Remove uniform buffer from index.

References set_uniform_buffer().

virtual void uicore::GraphicContext::set_blend_state ( const BlendStatePtr state,
const Colorf blend_color = Colorf::white,
unsigned int  sample_mask = 0xffffffff 
)
pure virtual

Set active blend state.

Referenced by reset_blend_state().

void uicore::GraphicContext::set_depth_range ( float  n,
float  f 
)
inline

Specifies the depth range for all viewports.

References set_depth_range().

Referenced by set_depth_range().

virtual void uicore::GraphicContext::set_depth_range ( int  viewport,
float  n,
float  f 
)
pure virtual

Specifies the depth range for the specified viewport.

virtual void uicore::GraphicContext::set_depth_stencil_state ( const DepthStencilStatePtr state,
int  stencil_ref = 0 
)
pure virtual

Set active depth stencil state.

Referenced by reset_depth_stencil_state().

virtual void uicore::GraphicContext::set_draw_buffer ( DrawBuffer  buffer)
pure virtual

Set used draw buffer.

void uicore::GraphicContext::set_frame_buffer ( const FrameBufferPtr write_buffer)
inline

Sets the current frame buffer.

References set_frame_buffer().

Referenced by reset_frame_buffer(), and set_frame_buffer().

virtual void uicore::GraphicContext::set_frame_buffer ( const FrameBufferPtr write_buffer,
const FrameBufferPtr read_buffer 
)
pure virtual
virtual void uicore::GraphicContext::set_image_texture ( int  unit_index,
const TexturePtr texture 
)
pure virtual

Select texture image into index.

Parameters
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().

void uicore::GraphicContext::set_image_textures ( const std::vector< TexturePtr > &  textures)
inline

Select texture images

Only textures units from 0 to textures.size()-1 are set.

Parameters
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().

void uicore::GraphicContext::set_image_textures ( int  start_index,
const std::vector< TexturePtr > &  textures 
)
inline

References uicore::i, and set_image_texture().

virtual void uicore::GraphicContext::set_primitives_array ( const PrimitivesArrayPtr array)
pure virtual

Set the primitives array on the gc.

Referenced by reset_primitives_array().

virtual void uicore::GraphicContext::set_primitives_elements ( const ElementArrayBufferPtr element_array)
pure virtual

Sets current elements array buffer.

Referenced by reset_primitives_elements().

virtual void uicore::GraphicContext::set_program_object ( StandardProgram  standard_program)
pure virtual

Set active program object to the standard program specified.

Referenced by reset_program_object().

virtual void uicore::GraphicContext::set_program_object ( const ProgramObjectPtr program)
pure virtual

Set active program object.

virtual void uicore::GraphicContext::set_rasterizer_state ( const RasterizerStatePtr state)
pure virtual

Set active rasterizer state.

Referenced by reset_rasterizer_state().

virtual void uicore::GraphicContext::set_scissor ( const Rect rect,
TextureImageYAxis  y_axis 
)
pure virtual

Set the current clipping rectangle.

virtual void uicore::GraphicContext::set_storage_buffer ( int  index,
const StorageBufferPtr buffer 
)
pure virtual

Select storage buffer into index.

Referenced by reset_storage_buffer().

virtual void uicore::GraphicContext::set_texture ( int  unit_index,
const TexturePtr texture 
)
pure virtual

Select texture into index.

Parameters
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().

void uicore::GraphicContext::set_textures ( const std::vector< TexturePtr > &  textures)
inline

Select textures

Parameters
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().

void uicore::GraphicContext::set_textures ( int  start_index,
const std::vector< TexturePtr > &  textures 
)
inline

References uicore::i, and set_texture().

virtual void uicore::GraphicContext::set_uniform_buffer ( int  index,
const UniformBufferPtr buffer 
)
pure virtual

Select uniform buffer into index.

Referenced by reset_uniform_buffer().

virtual void uicore::GraphicContext::set_viewport ( const Rectf viewport,
TextureImageYAxis  y_axis 
)
pure virtual

Set the viewport to be used in user projection map mode.

Parameters
viewport= The viewport to set
virtual void uicore::GraphicContext::set_viewport ( int  index,
const Rectf viewport,
TextureImageYAxis  y_axis 
)
pure virtual

Set the specified viewport to be used in user projection map mode.

Parameters
index= The viewport index (0 to x)
viewport= The viewport to set
virtual ShaderLanguage uicore::GraphicContext::shader_language ( ) const
pure virtual

Returns the shader language used.

virtual Size uicore::GraphicContext::size ( ) const
pure virtual

Returns the current actual size of the context.

Referenced by height(), pixeldata(), and width().

virtual TextureImageYAxis uicore::GraphicContext::texture_image_y_axis ( ) const
pure virtual

Returns the Y axis direction for viewports, clipping rects, textures and render targets.

int uicore::GraphicContext::width ( ) const
inline

Returns the current actual width of the context.

References size(), and uicore::Sizex< Type >::width.

Referenced by dip_width().

virtual FrameBufferPtr uicore::GraphicContext::write_frame_buffer ( ) const
pure virtual

Returns the currently selected write frame buffer.

Returns
The frame buffer.

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