graphic_context.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 ** Kenneth Gangstoe
29 */
30
31
32 #pragma once
33
34 #include "../2D/color.h"
35 #include "../Image/texture_format.h"
36 #include <memory>
37 #include "../../Core/Math/mat4.h"
38 #include "../../Core/Math/rect.h"
39 #include "../../Core/Signals/signal.h"
40 #include "primitives_array.h"
41 #include "frame_buffer.h"
42 #include "element_array_vector.h"
43
44 namespace clan
45 {
48
49 class Size;
50 class Texture;
51 class FrameBuffer;
52 class PixelBuffer;
53 class PrimitivesArray;
54 class Font;
55 class FontMetrics;
56 class GraphicContextProvider;
57 class GraphicContext_Impl;
58 class ProgramObject;
59 class Angle;
60 class RenderBatcher;
61 class FontProvider_Freetype;
62 class UniformBuffer;
63 class StorageBuffer;
64 class RasterizerState;
65 class BlendState;
66 class DepthStencilState;
67
69 enum CullMode
70 {
71 cull_front,
72 cull_back,
73 cull_front_and_back
74 };
75
77 enum FillMode
78 {
79 fill_point,
80 fill_line,
81 fill_polygon
82 };
83
85 enum FaceSide
86 {
87 face_clockwise,
88 face_counter_clockwise
89 };
90
92 enum CompareFunction
93 {
94 compare_lequal,
95 compare_gequal,
96 compare_less,
97 compare_greater,
98 compare_equal,
99 compare_notequal,
100 compare_always,
101 compare_never
102 };
103
105 enum StencilOp
106 {
107 stencil_keep,
108 stencil_zero,
109 stencil_replace,
110 stencil_incr,
111 stencil_decr,
112 stencil_invert,
113 stencil_incr_wrap,
114 stencil_decr_wrap
115 };
116
118 enum DrawBuffer
119 {
120 buffer_none,
121 buffer_front_left,
122 buffer_front_right,
123 buffer_back_left,
124 buffer_back_right,
125 buffer_front,
126 buffer_back,
127 buffer_left,
128 buffer_right,
129 buffer_front_and_back
130 };
131
133 enum LogicOp
134 {
135 logic_clear,
136 logic_and,
137 logic_and_reverse,
138 logic_copy,
139 logic_and_inverted,
140 logic_noop,
141 logic_xor,
142 logic_or,
143 logic_nor,
144 logic_equiv,
145 logic_invert,
146 logic_or_reverse,
147 logic_copy_inverted,
148 logic_or_inverted,
149 logic_nand,
150 logic_set
151 };
152
154 enum BlendFunc
155 {
157 blend_zero,
158
160 blend_one,
161
163 blend_dest_color,
164
166 blend_src_color,
167
169 blend_one_minus_dest_color,
170
172 blend_one_minus_src_color,
173
175 blend_src_alpha,
176
178 blend_one_minus_src_alpha,
179
181 blend_dest_alpha,
182
184 blend_one_minus_dest_alpha,
185
187 blend_src_alpha_saturate,
188
190 blend_constant_color,
191
193 blend_one_minus_constant_color,
194
196 blend_constant_alpha,
197
199 blend_one_minus_constant_alpha
200 };
201
203 enum BlendEquation
204 {
205 equation_add,
206 equation_subtract,
207 equation_reverse_subtract,
208 equation_min,
209 equation_max
210 };
211
213 enum PointSpriteOrigin
214 {
215 origin_upper_left,
216 origin_lower_left
217 };
218
220 enum PrimitivesType
221 {
222 type_points,
223 type_line_strip,
224 type_line_loop,
225 type_lines,
226 type_triangle_strip,
227 type_triangle_fan,
228 type_triangles
229 };
230
232 enum TextureImageYAxis
233 {
234 y_axis_bottom_up,
235 y_axis_top_down
236 };
237
239 enum StandardProgram
240 {
241 program_color_only,
242 program_single_texture,
243 program_sprite,
244 program_path
245 };
246
248 enum ShaderLanguage
249 {
250 shader_glsl,
251 shader_hlsl,
252 shader_fixed_function,
253 num_shader_languages
254 };
255
257 class GraphicContext
258 {
261
262 public:
264 GraphicContext();
265
269 GraphicContext(GraphicContextProvider *provider);
270
271 ~GraphicContext();
272
276 public:
278 bool is_null() const { return !impl; }
279
281 void throw_if_null() const;
282
284 ClipZRange get_clip_z_range() const;
285
287 TextureImageYAxis get_texture_image_y_axis() const;
288
290 ShaderLanguage get_shader_language() const;
291
296 int get_major_version() const;
297
302 int get_minor_version() const;
303
309 bool has_compute_shader_support() const;
310
316 Texture get_texture(int index) const;
317
322 std::vector<Texture> get_textures() const;
323
327 FrameBuffer get_write_frame_buffer() const;
328
332 FrameBuffer get_read_frame_buffer() const;
333
335 ProgramObject get_program_object() const;
336
338 int get_width() const;
339
341 int get_height() const;
342
344 Size get_size() const;
345
348 float get_pixel_ratio() const;
349
352 float get_dip_width() const { return get_width() / get_pixel_ratio(); }
353
356 float get_dip_height() const { return get_height() / get_pixel_ratio(); }
357
360 Sizef get_dip_size() const { return Sizef{ get_dip_width(), get_dip_height() }; }
361
366 Size get_max_texture_size() const;
367
369 GraphicContextProvider *get_provider();
370
371 const GraphicContextProvider * get_provider() const;
372
376 public:
378 GraphicContext create() const;
379
381 GraphicContext create(FrameBuffer &buffer) const;
382
384 GraphicContext clone() const;
385
387 PixelBuffer get_pixeldata(const Rect& rect, TextureFormat texture_format = tf_rgba8, bool clamp = true);
388
390 PixelBuffer get_pixeldata(TextureFormat texture_format = tf_rgba8, bool clamp = true);
391
399 bool is_frame_buffer_owner(const FrameBuffer &fb);
400
402 void set_frame_buffer(const FrameBuffer &write_buffer);
403 void set_frame_buffer(const FrameBuffer &write_buffer, const FrameBuffer &read_buffer);
404
406 void reset_frame_buffer();
407
409 void set_uniform_buffer(int index, const UniformBuffer &buffer);
410
412 void reset_uniform_buffer(int index);
413
415 void set_storage_buffer(int index, const StorageBuffer &buffer);
416
418 void reset_storage_buffer(int index);
419
424 void set_texture(int unit_index, const Texture &texture);
425
431 void set_textures(std::vector<Texture> &textures);
432
436 void reset_texture(int unit_index);
437
439 void reset_textures();
440
445 void set_image_texture(int unit_index, const Texture &texture);
446
452 void set_image_texture(std::vector<Texture> &textures);
453
457 void reset_image_texture(int unit_index);
458
460 void reset_image_textures();
461
463 void set_rasterizer_state(const RasterizerState &state);
464
466 void set_blend_state(const BlendState &state, const Colorf &blend_color = Colorf::white, unsigned int sample_mask = 0xffffffff);
467
469 void set_depth_stencil_state(const DepthStencilState &state, int stencil_ref = 0);
470
472 void reset_rasterizer_state();
473
475 void reset_blend_state();
476
478 void reset_depth_stencil_state();
479
481 void set_program_object(StandardProgram standard_program);
482
486 void set_program_object(const ProgramObject &program);
487
489 void reset_program_object();
490
495 bool is_primitives_array_owner(const PrimitivesArray &primitives_array);
496
498 void draw_primitives(PrimitivesType type, int num_vertices, const PrimitivesArray &array);
499
501 void set_primitives_array(const PrimitivesArray &array);
502
504 void draw_primitives_array(PrimitivesType type, int num_vertices);
505
511 void draw_primitives_array(PrimitivesType type, int offset, int num_vertices);
512
519 void draw_primitives_array_instanced(PrimitivesType type, int offset, int num_vertices, int instance_count);
520
522 void set_primitives_elements(ElementArrayBuffer &element_array);
523
525 template<typename Type>
526 void set_primitives_elements(ElementArrayVector<Type> &element_array)
527 {
528 set_primitives_elements((ElementArrayBuffer&)element_array);
529 }
530
537 void draw_primitives_elements(PrimitivesType type, int count, VertexAttributeDataType indices_type, size_t offset = 0);
538
546 void draw_primitives_elements_instanced(PrimitivesType type, int count, VertexAttributeDataType indices_type, size_t offset, int instance_count);
547
549 void reset_primitives_elements();
550
558 void draw_primitives_elements(PrimitivesType type, int count, ElementArrayBuffer &element_array, VertexAttributeDataType indices_type, size_t offset = 0);
559
567 void draw_primitives_elements(PrimitivesType type, int count, ElementArrayVector<unsigned int> &element_array, size_t offset = 0)
568 {
569 draw_primitives_elements(type, count, (ElementArrayBuffer&)element_array, type_unsigned_int, offset * sizeof(unsigned int));
570 }
571
579 void draw_primitives_elements(PrimitivesType type, int count, ElementArrayVector<unsigned short> &element_array, size_t offset = 0)
580 {
581 draw_primitives_elements(type, count, (ElementArrayBuffer&)element_array, type_unsigned_short, offset * sizeof(unsigned short));
582 }
583
591 void draw_primitives_elements(PrimitivesType type, int count, ElementArrayVector<unsigned char> &element_array, size_t offset = 0)
592 {
593 draw_primitives_elements(type, count, (ElementArrayBuffer&)element_array, type_unsigned_byte, offset * sizeof(unsigned char));
594 }
595
604 void draw_primitives_elements_instanced(PrimitivesType type, int count, ElementArrayBuffer &element_array, VertexAttributeDataType indices_type, size_t offset, int instance_count);
605
614 void draw_primitives_elements_instanced(PrimitivesType type, int count, ElementArrayVector<unsigned int> &element_array, size_t offset, int instance_count)
615 {
616 draw_primitives_elements_instanced(type, count, (ElementArrayBuffer&)element_array, type_unsigned_int, offset * sizeof(unsigned int), instance_count);
617 }
618
627 void draw_primitives_elements_instanced(PrimitivesType type, int count, ElementArrayVector<unsigned short> &element_array, size_t offset, int instance_count)
628 {
629 draw_primitives_elements_instanced(type, count, (ElementArrayBuffer&)element_array, type_unsigned_short, offset * sizeof(unsigned short), instance_count);
630 }
631
640 void draw_primitives_elements_instanced(PrimitivesType type, int count, ElementArrayVector<unsigned char> &element_array, size_t offset, int instance_count)
641 {
642 draw_primitives_elements_instanced(type, count, (ElementArrayBuffer&)element_array, type_unsigned_byte, offset * sizeof(unsigned char), instance_count);
643 }
644
646 void reset_primitives_array();
647
649 void dispatch(int x = 1, int y = 1, int z = 1);
650
652 void clear(const Colorf &color = Colorf::black);
653
657 void clear_stencil(int value = 0);
658
662 void clear_depth(float value = 0);
663
665 void set_scissor(const Rect &rect, TextureImageYAxis y_axis);
666
668 void reset_scissor();
669
673 void set_viewport(const Rectf &viewport);
674
679 void set_viewport(int index, const Rectf &viewport);
680
682 void set_depth_range(float n, float f);
683
685 void set_depth_range(int viewport, float n, float f);
686
688 void set_draw_buffer(DrawBuffer buffer);
689
691 void flush();
692
696 public:
697
701 public:
702 bool operator ==(const GraphicContext &other) const { return impl == other.impl; }
703 bool operator !=(const GraphicContext &other) const { return impl != other.impl; }
704
708 private:
709 std::shared_ptr<GraphicContext_Impl> impl;
710
711 friend class OpenGL;
713 };
714
715 const float pixelcenter_constant = 0.375f;
716
717 }
718
clan::buffer_front
Definition: graphic_context.h:125
clan::PointSpriteOrigin
PointSpriteOrigin
Point Sprite Origin.
Definition: graphic_context.h:213
clan::PrimitivesArray
Primitives array description.
Definition: primitives_array.h:68
clan::GraphicContext::get_dip_size
Sizef get_dip_size() const
Definition: graphic_context.h:360
clan::Key::n
clan::logic_and_inverted
Definition: graphic_context.h:139
clan::GraphicContext::reset_textures
void reset_textures()
Remove all selected textures.
clan::GraphicContext::is_primitives_array_owner
bool is_primitives_array_owner(const PrimitivesArray &primitives_array)
clan::GraphicContext::set_frame_buffer
void set_frame_buffer(const FrameBuffer &write_buffer)
Sets the current frame buffer.
clan::GraphicContext::set_viewport
void set_viewport(const Rectf &viewport)
clan::GraphicContext::set_scissor
void set_scissor(const Rect &rect, TextureImageYAxis y_axis)
Set the current clipping rectangle.
clan
Definition: clanapp.h:35
clan::GraphicContext::reset_storage_buffer
void reset_storage_buffer(int index)
Remove storage buffer from index.
clan::Colorf
Floating point color description class (for float).
Definition: color.h:660
clan::GraphicContext::reset_depth_stencil_state
void reset_depth_stencil_state()
Set active depth stencil state.
clan::GraphicContext::set_image_texture
void set_image_texture(int unit_index, const Texture &texture)
clan::GraphicContext::get_dip_height
float get_dip_height() const
Definition: graphic_context.h:356
clan::RasterizerState
Rasterizer state setup.
Definition: rasterizer_state.h:44
clan::logic_nor
Definition: graphic_context.h:143
clan::blend_one_minus_dest_alpha
source or destination (1, 1, 1, 1) - (Ad, Ad, Ad, Ad)
Definition: graphic_context.h:184
clan::blend_constant_alpha
source or destination (Ac, Ac, Ac, Ac)
Definition: graphic_context.h:196
clan::buffer_front_right
Definition: graphic_context.h:122
clan::GraphicContext::get_clip_z_range
ClipZRange get_clip_z_range() const
Returns in what range clip space z values are clipped.
clan::GraphicContext::create
GraphicContext create() const
Create a new default graphic context compatible with this one.
clan::Colorf::white
static Colorf white
Definition: color.h:1251
clan::blend_one_minus_src_color
destination (1, 1, 1, 1) - (Rs, Gs, Bs, As)
Definition: graphic_context.h:172
clan::GraphicContext::set_primitives_elements
void set_primitives_elements(ElementArrayBuffer &element_array)
Sets current elements array buffer.
clan::GraphicContext::clear_depth
void clear_depth(float value=0)
clan::GraphicContext::reset_image_texture
void reset_image_texture(int unit_index)
clan::GraphicContext::~GraphicContext
~GraphicContext()
clan::FrameBuffer
Frame-buffer object class.
Definition: frame_buffer.h:72
clan::blend_src_alpha_saturate
source (f, f, f, 1) - f = min(As, 1 - Ad)
Definition: graphic_context.h:187
clan::shader_fixed_function
Definition: graphic_context.h:252
clan::equation_add
Definition: graphic_context.h:205
clan::origin_lower_left
Definition: graphic_context.h:216
clan::logic_xor
Definition: graphic_context.h:141
clan::FaceSide
FaceSide
Front face modes.
Definition: graphic_context.h:85
clan::logic_and_reverse
Definition: graphic_context.h:137
clan::fill_polygon
Definition: graphic_context.h:81
clan::logic_or
Definition: graphic_context.h:142
clan::GraphicContext::get_height
int get_height() const
Returns the current actual height of the context.
clan::GraphicContextProvider
Interface for implementing a GraphicContext target.
Definition: graphic_context_provider.h:86
clan::Texture
Texture object class.
Definition: texture.h:103
clan::logic_noop
Definition: graphic_context.h:140
clan::GraphicContext::clear_stencil
void clear_stencil(int value=0)
clan::stencil_replace
Definition: graphic_context.h:109
clan::logic_set
Definition: graphic_context.h:150
clan::GraphicContext::draw_primitives_elements_instanced
void draw_primitives_elements_instanced(PrimitivesType type, int count, ElementArrayVector< unsigned int > &element_array, size_t offset, int instance_count)
Definition: graphic_context.h:614
clan::PixelBuffer
Pixel data container.
Definition: pixel_buffer.h:68
clan::stencil_keep
Definition: graphic_context.h:107
clan::Key::x
clan::BlendState
Blend state setup.
Definition: blend_state.h:44
clan::buffer_left
Definition: graphic_context.h:127
clan::ElementArrayVector
Element Array Vector.
Definition: element_array_vector.h:43
clan::type_points
Definition: graphic_context.h:222
clan::GraphicContext::get_major_version
int get_major_version() const
clan::BlendEquation
BlendEquation
Blending equations.
Definition: graphic_context.h:203
clan::GraphicContext::get_width
int get_width() const
Returns the current actual width of the context.
clan::GraphicContext::dispatch
void dispatch(int x=1, int y=1, int z=1)
Execute a compute shader.
clan::compare_never
Definition: graphic_context.h:101
clan::OpenGL
OpenGL utility class.
Definition: opengl.h:73
clan::GraphicContext::flush
void flush()
Flush the command buffer.
clan::y_axis_bottom_up
OpenGL, origin is lower left with Y going upwards.
Definition: graphic_context.h:234
clan::type_lines
Definition: graphic_context.h:225
clan::blend_one_minus_dest_color
source (1, 1, 1, 1) - (Rd, Gd, Bd, Ad)
Definition: graphic_context.h:169
clan::DrawBuffer
DrawBuffer
Drawing buffers.
Definition: graphic_context.h:118
clan::equation_reverse_subtract
Definition: graphic_context.h:207
clan::GraphicContext::set_primitives_elements
void set_primitives_elements(ElementArrayVector< Type > &element_array)
Sets current elements array buffer.
Definition: graphic_context.h:526
clan::y_axis_top_down
Direct3D, origin is upper left with Y going downwards.
Definition: graphic_context.h:235
clan::GraphicContext::draw_primitives
void draw_primitives(PrimitivesType type, int num_vertices, const PrimitivesArray &array)
Draw primitives on gc.
clan::GraphicContext::get_write_frame_buffer
FrameBuffer get_write_frame_buffer() const
clan::ShaderLanguage
ShaderLanguage
Shader language used.
Definition: graphic_context.h:248
clan::face_counter_clockwise
Definition: graphic_context.h:88
clan::GraphicContext::draw_primitives_elements
void draw_primitives_elements(PrimitivesType type, int count, ElementArrayVector< unsigned char > &element_array, size_t offset=0)
Definition: graphic_context.h:591
clan::GraphicContext::set_depth_stencil_state
void set_depth_stencil_state(const DepthStencilState &state, int stencil_ref=0)
Set active depth stencil state.
clan::face_clockwise
Definition: graphic_context.h:87
clan::logic_copy_inverted
Definition: graphic_context.h:147
clan::CullMode
CullMode
Polygon culling modes.
Definition: graphic_context.h:69
clan::GraphicContext::set_textures
void set_textures(std::vector< Texture > &textures)
clan::ClipZRange
ClipZRange
Definition: mat4.h:51
clan::cull_front
Definition: graphic_context.h:71
clan::GraphicContext::draw_primitives_elements_instanced
void draw_primitives_elements_instanced(PrimitivesType type, int count, ElementArrayVector< unsigned short > &element_array, size_t offset, int instance_count)
Definition: graphic_context.h:627
clan::GraphicContext::get_shader_language
ShaderLanguage get_shader_language() const
Returns the shader language used.
clan::GraphicContext::clone
GraphicContext clone() const
Create a new default graphic context cloned with this one.
clan::GraphicContext::reset_rasterizer_state
void reset_rasterizer_state()
Set active rasterizer state.
clan::GraphicContext::get_pixel_ratio
float get_pixel_ratio() const
clan::compare_lequal
Definition: graphic_context.h:94
clan::stencil_zero
Definition: graphic_context.h:108
clan::GraphicContext::draw_primitives_array
void draw_primitives_array(PrimitivesType type, int num_vertices)
Draws primitives from the current assigned primitives array.
clan::GraphicContext::get_pixeldata
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.
clan::GraphicContext::reset_scissor
void reset_scissor()
Removes the set clipping rectangle.
clan::compare_less
Definition: graphic_context.h:96
clan::GraphicContext::set_storage_buffer
void set_storage_buffer(int index, const StorageBuffer &buffer)
Select storage buffer into index.
clan::GraphicContext::reset_texture
void reset_texture(int unit_index)
clan::StandardProgram
StandardProgram
Standard Program.
Definition: graphic_context.h:239
clan::Rect
2D (left,top,right,bottom) rectangle structure - Integer
Definition: rect.h:470
clan::GraphicContext::is_frame_buffer_owner
bool is_frame_buffer_owner(const FrameBuffer &fb)
clan::GraphicContext::get_max_texture_size
Size get_max_texture_size() const
clan::StencilOp
StencilOp
Stencil operations.
Definition: graphic_context.h:105
clan::blend_one_minus_constant_alpha
source or destination (1, 1, 1, 1) - (Ac, Ac, Ac, Ac)
Definition: graphic_context.h:199
clan::GraphicContext::set_draw_buffer
void set_draw_buffer(DrawBuffer buffer)
Set used draw buffer.
clan::program_sprite
Definition: graphic_context.h:243
clan::GraphicContext::set_primitives_array
void set_primitives_array(const PrimitivesArray &array)
Set the primitives array on the gc.
clan::GraphicContext::reset_primitives_array
void reset_primitives_array()
Reset the primitives arrays.
clan::logic_and
Definition: graphic_context.h:136
clan::compare_greater
Definition: graphic_context.h:97
clan::type_line_strip
Definition: graphic_context.h:223
clan::GraphicContext::draw_primitives_elements_instanced
void draw_primitives_elements_instanced(PrimitivesType type, int count, VertexAttributeDataType indices_type, size_t offset, int instance_count)
clan::stencil_incr_wrap
Definition: graphic_context.h:113
clan::Key::f
clan::num_shader_languages
Definition: graphic_context.h:253
clan::Rectf
2D (left,top,right,bottom) rectangle structure - Float
Definition: rect.h:484
clan::type_unsigned_byte
Definition: primitives_array.h:58
clan::compare_equal
Definition: graphic_context.h:98
clan::GraphicContext::reset_uniform_buffer
void reset_uniform_buffer(int index)
Remove uniform buffer from index.
clan::FillMode
FillMode
Polygon filling modes.
Definition: graphic_context.h:77
clan::Key::y
clan::cull_back
Definition: graphic_context.h:72
clan::GraphicContext::get_texture
Texture get_texture(int index) const
clan::GraphicContext::get_read_frame_buffer
FrameBuffer get_read_frame_buffer() const
clan::GraphicContext::get_program_object
ProgramObject get_program_object() const
Returns the currently selected program object.
clan::GraphicContext::draw_primitives_elements
void draw_primitives_elements(PrimitivesType type, int count, ElementArrayVector< unsigned short > &element_array, size_t offset=0)
Definition: graphic_context.h:579
clan::GraphicContext::is_null
bool is_null() const
Returns true if this object is invalid.
Definition: graphic_context.h:278
clan::shader_glsl
Definition: graphic_context.h:250
clan::blend_one
source or destination (1, 1, 1, 1)
Definition: graphic_context.h:160
clan::buffer_back_right
Definition: graphic_context.h:124
clan::equation_subtract
Definition: graphic_context.h:206
clan::compare_gequal
Definition: graphic_context.h:95
clan::type_triangles
Definition: graphic_context.h:228
clan::blend_one_minus_src_alpha
source or destination (1, 1, 1, 1) - (As, As, As, As)
Definition: graphic_context.h:178
clan::logic_equiv
Definition: graphic_context.h:144
clan::TextureFormat
TextureFormat
Texture format.
Definition: texture_format.h:40
clan::TextureImageYAxis
TextureImageYAxis
Y axis direction for viewports, clipping rects, textures and render targets.
Definition: graphic_context.h:232
clan::GraphicContext::get_size
Size get_size() const
Returns the current actual size of the context.
clan::pixelcenter_constant
const float pixelcenter_constant
Definition: graphic_context.h:715
clan::type_unsigned_short
Definition: primitives_array.h:59
clan::type_triangle_fan
Definition: graphic_context.h:227
clan::GraphicContext::get_provider
GraphicContextProvider * get_provider()
Returns the provider for this graphic context.
clan::GraphicContext::has_compute_shader_support
bool has_compute_shader_support() const
clan::buffer_back
Definition: graphic_context.h:126
clan::GraphicContext::set_rasterizer_state
void set_rasterizer_state(const RasterizerState &state)
Set active rasterizer state.
clan::type_triangle_strip
Definition: graphic_context.h:226
clan::stencil_decr
Definition: graphic_context.h:111
clan::logic_invert
Definition: graphic_context.h:145
clan::origin_upper_left
Definition: graphic_context.h:215
clan::program_path
Definition: graphic_context.h:244
clan::GraphicContext::draw_primitives_elements_instanced
void draw_primitives_elements_instanced(PrimitivesType type, int count, ElementArrayVector< unsigned char > &element_array, size_t offset, int instance_count)
Definition: graphic_context.h:640
clan::blend_src_alpha
source or destination (As, As, As, As)
Definition: graphic_context.h:175
clan::type_unsigned_int
Definition: primitives_array.h:60
clan::GraphicContext::set_program_object
void set_program_object(StandardProgram standard_program)
Set active program object to the standard program specified.
clan::ElementArrayBuffer
Element Array Buffer.
Definition: element_array_buffer.h:46
clan::GraphicContext::reset_image_textures
void reset_image_textures()
Remove all selected textures.
clan::UniformBuffer
Uniform Buffer.
Definition: uniform_buffer.h:47
clan::logic_nand
Definition: graphic_context.h:149
clan::GraphicContext
Interface to drawing graphics.
Definition: graphic_context.h:257
clan::BlendFunc
BlendFunc
Blending functions.
Definition: graphic_context.h:154
clan::logic_or_inverted
Definition: graphic_context.h:148
clan::VertexAttributeDataType
VertexAttributeDataType
Primitives array description.
Definition: primitives_array.h:56
clan::GraphicContext::GraphicContext
GraphicContext()
Constructs a null instance.
clan::equation_min
Definition: graphic_context.h:208
clan::blend_dest_color
source (Rd, Gd, Bd, Ad)
Definition: graphic_context.h:163
clan::GraphicContext::draw_primitives_elements
void draw_primitives_elements(PrimitivesType type, int count, VertexAttributeDataType indices_type, size_t offset=0)
clan::GraphicContext::get_minor_version
int get_minor_version() const
clan::GraphicContext::reset_frame_buffer
void reset_frame_buffer()
Resets the current frame buffer to be the initial frame buffer.
clan::GraphicContext::throw_if_null
void throw_if_null() const
Throw an exception if this object is invalid.
clan::GraphicContext::get_texture_image_y_axis
TextureImageYAxis get_texture_image_y_axis() const
Returns the Y axis direction for viewports, clipping rects, textures and render targets.
clan::GraphicContext::set_blend_state
void set_blend_state(const BlendState &state, const Colorf &blend_color=Colorf::white, unsigned int sample_mask=0xffffffff)
Set active blend state.
clan::GraphicContext::reset_program_object
void reset_program_object()
Remove active program object.
clan::GraphicContext::draw_primitives_elements
void draw_primitives_elements(PrimitivesType type, int count, ElementArrayVector< unsigned int > &element_array, size_t offset=0)
Definition: graphic_context.h:567
clan::equation_max
Definition: graphic_context.h:209
clan::BrushWrapMode::clamp
clan::ProgramObject
Program Object.
Definition: program_object.h:69
clan::CompareFunction
CompareFunction
Compare functions.
Definition: graphic_context.h:92
clan::blend_constant_color
source or destination (Rc, Gc, Bc, Ac)
Definition: graphic_context.h:190
clan::fill_point
Definition: graphic_context.h:79
clan::cull_front_and_back
Definition: graphic_context.h:73
clan::GraphicContext::set_uniform_buffer
void set_uniform_buffer(int index, const UniformBuffer &buffer)
Select uniform buffer into index.
clan::blend_zero
source or destination (0, 0, 0, 0)
Definition: graphic_context.h:157
clan::GraphicContext::draw_primitives_array_instanced
void draw_primitives_array_instanced(PrimitivesType type, int offset, int num_vertices, int instance_count)
clan::GraphicContext::operator==
bool operator==(const GraphicContext &other) const
Definition: graphic_context.h:702
clan::GraphicContext::operator!=
bool operator!=(const GraphicContext &other) const
Definition: graphic_context.h:703
clan::logic_or_reverse
Definition: graphic_context.h:146
clan::Size
2D (width,height) size structure - Integer
Definition: size.h:156
clan::DepthStencilState
DepthStencil state setup.
Definition: depth_stencil_state.h:44
clan::Colorf::black
static Colorf black
Definition: color.h:843
clan::buffer_front_left
Definition: graphic_context.h:121
clan::fill_line
Definition: graphic_context.h:80
clan::StorageBuffer
Storage Buffer.
Definition: storage_buffer.h:47
clan::GraphicContext::get_textures
std::vector< Texture > get_textures() const
clan::GraphicContext::clear
void clear(const Colorf &color=Colorf::black)
Clears the whole context using the specified color.
clan::GraphicContext::reset_blend_state
void reset_blend_state()
Set active blend state.
clan::type_line_loop
Definition: graphic_context.h:224
clan::blend_src_color
destination (Rs, Gs, Bs, As)
Definition: graphic_context.h:166
clan::LogicOp
LogicOp
Logic Op.
Definition: graphic_context.h:133
clan::GraphicContext::reset_primitives_elements
void reset_primitives_elements()
Resets current elements array buffer.
clan::StyleValueType::color
value is an url
clan::PrimitivesType
PrimitivesType
Primitive types.
Definition: graphic_context.h:220
clan::blend_one_minus_constant_color
source or destination (1, 1, 1, 1) - (Rc, Gc, Bc, Ac)
Definition: graphic_context.h:193
clan::compare_always
Definition: graphic_context.h:100
clan::tf_rgba8
Definition: texture_format.h:43
clan::logic_copy
Definition: graphic_context.h:138
clan::compare_notequal
Definition: graphic_context.h:99
clan::stencil_decr_wrap
Definition: graphic_context.h:114
clan::program_single_texture
Definition: graphic_context.h:242
clan::GraphicContext::get_dip_width
float get_dip_width() const
Definition: graphic_context.h:352
clan::shader_hlsl
Definition: graphic_context.h:251
clan::buffer_none
Definition: graphic_context.h:120
clan::buffer_back_left
Definition: graphic_context.h:123
clan::buffer_front_and_back
Definition: graphic_context.h:129
clan::GraphicContext::set_texture
void set_texture(int unit_index, const Texture &texture)
clan::stencil_incr
Definition: graphic_context.h:110
clan::blend_dest_alpha
source or destination (Ad, Ad, Ad, Ad)
Definition: graphic_context.h:181
clan::buffer_right
Definition: graphic_context.h:128
clan::Sizef
2D (width,height) size structure - Float
Definition: size.h:169
clan::program_color_only
Definition: graphic_context.h:241
clan::Key::z
clan::stencil_invert
Definition: graphic_context.h:112
clan::GraphicContext::set_depth_range
void set_depth_range(float n, float f)
Specifies the depth range for all viewports.
clan::logic_clear
Definition: graphic_context.h:135