33 #include "../2D/color.h" 34 #include "../Image/texture_format.h" 36 #include "../../Core/Math/mat4.h" 37 #include "../../Core/Math/rect.h" 38 #include "../../Core/Signals/signal.h" 39 #include "primitives_array.h" 40 #include "frame_buffer.h" 41 #include "element_array_vector.h" 52 class PrimitivesArray;
55 class GraphicContextProvider;
56 class GraphicContext_Impl;
60 class FontProvider_Freetype;
63 class RasterizerState;
65 class DepthStencilState;
271 explicit operator bool()
const {
return bool(impl); }
514 template<
typename Type>
686 std::shared_ptr<GraphicContext_Impl> impl;
PointSpriteOrigin
Point Sprite Origin.
Definition: graphic_context.h:212
Primitives array description.
Definition: primitives_array.h:67
void draw_primitives_elements(PrimitivesType type, int count, ElementArrayVector< unsigned int > &element_array, size_t offset=0)
Definition: graphic_context.h:556
void draw_primitives_elements(PrimitivesType type, int count, VertexAttributeDataType indices_type, size_t offset=0)
void reset_textures()
Remove all selected textures.
Floating point color description class (for float).
Definition: color.h:798
ProgramObject get_program_object() const
Returns the currently selected program object.
Rasterizer state setup.
Definition: rasterizer_state.h:43
void draw_primitives_array_instanced(PrimitivesType type, int offset, int num_vertices, int instance_count)
void reset_frame_buffer()
Resets the current frame buffer to be the initial frame buffer.
source or destination (Ac, Ac, Ac, Ac)
void reset_texture(int unit_index)
Sizef get_dip_size() const
Definition: graphic_context.h:353
void clear_stencil(int value=0)
destination (1, 1, 1, 1) - (Rs, Gs, Bs, As)
void reset_rasterizer_state()
Set active rasterizer state.
source or destination (As, As, As, As)
Frame-buffer object class.
Definition: frame_buffer.h:71
OpenGL, origin is lower left with Y going upwards.
FaceSide
Front face modes.
Definition: graphic_context.h:84
PixelBuffer get_pixeldata(const Rect &rect, TextureFormat texture_format=TextureFormat::rgba8, bool clamp=true)
Return the content of the read buffer into a pixel buffer.
source (1, 1, 1, 1) - (Rd, Gd, Bd, Ad)
Interface for implementing a GraphicContext target.
Definition: graphic_context_provider.h:85
Texture object class.
Definition: texture.h:102
FrameBuffer get_read_frame_buffer() const
FrameBuffer get_write_frame_buffer() const
void draw_primitives_elements(PrimitivesType type, int count, ElementArrayVector< unsigned char > &element_array, size_t offset=0)
Definition: graphic_context.h:580
void draw_primitives_elements_instanced(PrimitivesType type, int count, VertexAttributeDataType indices_type, size_t offset, int instance_count)
Pixel data container.
Definition: pixel_buffer.h:67
int get_major_version() const
void reset_uniform_buffer(int index)
Remove uniform buffer from index.
Blend state setup.
Definition: blend_state.h:43
void set_scissor(const Rect &rect, TextureImageYAxis y_axis)
Set the current clipping rectangle.
Element Array Vector.
Definition: element_array_vector.h:42
ClipZRange get_clip_z_range() const
Returns in what range clip space z values are clipped.
BlendEquation
Blending equations.
Definition: graphic_context.h:202
void draw_primitives_elements(PrimitivesType type, int count, ElementArrayVector< unsigned short > &element_array, size_t offset=0)
Definition: graphic_context.h:568
void draw_primitives_elements_instanced(PrimitivesType type, int count, ElementArrayVector< unsigned char > &element_array, size_t offset, int instance_count)
Definition: graphic_context.h:629
OpenGL utility class.
Definition: opengl.h:73
TextureImageYAxis get_texture_image_y_axis() const
Returns the Y axis direction for viewports, clipping rects, textures and render targets.
bool is_null() const
Returns true if this object is invalid.
Definition: graphic_context.h:270
void set_primitives_elements(ElementArrayBuffer &element_array)
Sets current elements array buffer.
void set_texture(int unit_index, const Texture &texture)
void throw_if_null() const
Throw an exception if this object is invalid.
DrawBuffer
Drawing buffers.
Definition: graphic_context.h:117
GraphicContext()
Constructs a null instance.
void set_rasterizer_state(const RasterizerState &state)
Set active rasterizer state.
ShaderLanguage
Shader language used.
Definition: graphic_context.h:247
CullMode
Polygon culling modes.
Definition: graphic_context.h:68
ClipZRange
Definition: mat4.h:50
void set_draw_buffer(DrawBuffer buffer)
Set used draw buffer.
source or destination (1, 1, 1, 1) - (Rc, Gc, Bc, Ac)
Texture get_texture(int index) const
bool is_frame_buffer_owner(const FrameBuffer &fb)
void reset_scissor()
Removes the set clipping rectangle.
void reset_primitives_elements()
Resets current elements array buffer.
source or destination (1, 1, 1, 1) - (Ad, Ad, Ad, Ad)
void set_depth_range(float n, float f)
Specifies the depth range for all viewports.
void set_primitives_array(const PrimitivesArray &array)
Set the primitives array on the gc.
StandardProgram
Standard Program.
Definition: graphic_context.h:238
2D (left,top,right,bottom) rectangle structure - Integer
Definition: rect.h:488
source or destination (1, 1, 1, 1) - (As, As, As, As)
source or destination (Ad, Ad, Ad, Ad)
void set_primitives_elements(ElementArrayVector< Type > &element_array)
Sets current elements array buffer.
Definition: graphic_context.h:515
StencilOp
Stencil operations.
Definition: graphic_context.h:104
void draw_primitives(PrimitivesType type, int num_vertices, const PrimitivesArray &array)
Draw primitives on gc.
void reset_depth_stencil_state()
Set active depth stencil state.
2D (left,top,right,bottom) rectangle structure - Float
Definition: rect.h:502
int get_width() const
Returns the current actual width of the context.
FillMode
Polygon filling modes.
Definition: graphic_context.h:76
void reset_blend_state()
Set active blend state.
void set_frame_buffer(const FrameBuffer &write_buffer)
Sets the current frame buffer.
void set_viewport(const Rectf &viewport)
void draw_primitives_elements_instanced(PrimitivesType type, int count, ElementArrayVector< unsigned short > &element_array, size_t offset, int instance_count)
Definition: graphic_context.h:616
void reset_storage_buffer(int index)
Remove storage buffer from index.
void set_program_object(StandardProgram standard_program)
Set active program object to the standard program specified.
destination (Rs, Gs, Bs, As)
float get_dip_width() const
Definition: graphic_context.h:345
TextureFormat
Texture format.
Definition: texture_format.h:38
TextureImageYAxis
Y axis direction for viewports, clipping rects, textures and render targets.
Definition: graphic_context.h:231
GraphicContext clone() const
Create a new default graphic context cloned with this one.
const float pixelcenter_constant
Definition: graphic_context.h:691
void draw_primitives_elements_instanced(PrimitivesType type, int count, ElementArrayVector< unsigned int > &element_array, size_t offset, int instance_count)
Definition: graphic_context.h:603
void set_uniform_buffer(int index, const UniformBuffer &buffer)
Select uniform buffer into index.
source (f, f, f, 1) - f = min(As, 1 - Ad)
void dispatch(int x=1, int y=1, int z=1)
Execute a compute shader.
void clear_depth(float value=0)
static Colorf black()
Definition: color.h:1747
bool operator==(const GraphicContext &other) const
Definition: graphic_context.h:682
void set_image_texture(int unit_index, const Texture &texture)
void draw_primitives_array(PrimitivesType type, int num_vertices)
Draws primitives from the current assigned primitives array.
void reset_program_object()
Remove active program object.
Element Array Buffer.
Definition: element_array_buffer.h:45
source or destination (1, 1, 1, 1) - (Ac, Ac, Ac, Ac)
source or destination (Rc, Gc, Bc, Ac)
bool operator!=(const GraphicContext &other) const
Definition: graphic_context.h:683
Interface to drawing graphics.
Definition: graphic_context.h:256
BlendFunc
Blending functions.
Definition: graphic_context.h:153
VertexAttributeDataType
Primitives array description.
Definition: primitives_array.h:55
void clear(const Colorf &color=StandardColorf::black())
Clears the whole context using the specified color.
static Colorf white()
Definition: color.h:1884
bool has_compute_shader_support() const
Program Object.
Definition: program_object.h:68
CompareFunction
Compare functions.
Definition: graphic_context.h:91
int get_minor_version() const
float get_pixel_ratio() const
source or destination (0, 0, 0, 0)
GraphicContext create() const
Create a new default graphic context compatible with this one.
float get_dip_height() const
Definition: graphic_context.h:349
2D (width,height) size structure - Integer
Definition: size.h:170
void reset_image_texture(int unit_index)
void set_depth_stencil_state(const DepthStencilState &state, int stencil_ref=0)
Set active depth stencil state.
DepthStencil state setup.
Definition: depth_stencil_state.h:43
Size get_max_texture_size() const
Storage Buffer.
Definition: storage_buffer.h:46
void set_textures(std::vector< Texture > &textures)
void reset_primitives_array()
Reset the primitives arrays.
void reset_image_textures()
Remove all selected textures.
std::vector< Texture > get_textures() const
LogicOp
Logic Op.
Definition: graphic_context.h:132
PrimitivesType
Primitive types.
Definition: graphic_context.h:219
source or destination (1, 1, 1, 1)
int get_height() const
Returns the current actual height of the context.
Direct3D, origin is upper left with Y going downwards.
bool is_primitives_array_owner(const PrimitivesArray &primitives_array)
void set_blend_state(const BlendState &state, const Colorf &blend_color=StandardColorf::white(), unsigned int sample_mask=0xffffffff)
Set active blend state.
void flush()
Flush the command buffer.
Size get_size() const
Returns the current actual size of the context.
void set_storage_buffer(int index, const StorageBuffer &buffer)
Select storage buffer into index.
GraphicContextProvider * get_provider()
Returns the provider for this graphic context.
ShaderLanguage get_shader_language() const
Returns the shader language used.
2D (width,height) size structure - Float
Definition: size.h:183