ClanLib
2.3.7
|
GL1 Graphic Context. More...
#include <graphic_context_gl1.h>
Public Member Functions | |
CL_GraphicContext_GL1 () | |
Construction. More... | |
CL_GraphicContext_GL1 (CL_GraphicContext &gc) | |
Create a GL1 specific graphics context. More... | |
~CL_GraphicContext_GL1 () | |
int | get_light_count () |
Get Light count. More... | |
int | get_max_texture_coords () |
Get Max texture coords. More... | |
void | get_opengl_version (int &version_major, int &version_minor, int &version_release) |
Get the opengl version. More... | |
bool | is_null () const |
Attributes. More... | |
void | pop_texture_matrix (int unit_index) |
Pop texture matrix. More... | |
void | push_texture_matrix (int unit_index) |
Operations. More... | |
void | reset_back_material () |
Reset back material. More... | |
void | reset_color_material () |
Reset color material. More... | |
void | reset_front_material () |
Reset front material. More... | |
void | reset_light (int light_index) |
Reset light. More... | |
void | reset_light_model () |
Reset light model. More... | |
void | reset_material () |
Reset material. More... | |
void | set_active () |
Sets the thread's OpenGL context to the one used by the graphic context. More... | |
void | set_back_material (const CL_Material_GL1 &material) |
Set back material. More... | |
void | set_color_material (CL_ColorMaterial_GL1 color) |
Set color material. More... | |
void | set_color_material (GLenum face, CL_ColorMaterial_GL1 color) |
Set color material. More... | |
void | set_color_material_back (CL_ColorMaterial_GL1 color) |
Set color material back. More... | |
void | set_color_material_front (CL_ColorMaterial_GL1 color) |
Set color material front. More... | |
void | set_front_material (const CL_Material_GL1 &material) |
Set front material. More... | |
void | set_light (int light_index, const CL_LightSource_GL1 &light) |
Set light. More... | |
void | set_light_model (const CL_LightModel_GL1 &light_model) |
Set light model. More... | |
void | set_material (const CL_Material_GL1 &material) |
Set material. More... | |
void | set_material (GLenum face, const CL_Material_GL1 &material) |
Set material. More... | |
void | set_texture_matrix (int unit_index, const CL_Mat4f &matrix) |
Set texture matrix. More... | |
void | set_texture_unit (int unit_index, const CL_TextureUnit_GL1 &unit) |
Set texture unit. More... | |
void | throw_if_null () const |
Throw an exception if this object is invalid. More... | |
Attributes | |
CL_Texture | get_texture (int index) const |
Returns the currently selected texture for the specified index. More... | |
std::vector< CL_Texture > | get_textures () const |
Returns the currently selected textures. More... | |
CL_BlendMode | get_blend_mode () const |
Returns the blending mode description. More... | |
CL_BufferControl | get_buffer_control () const |
Returns the buffer control description. More... | |
CL_PolygonRasterizer | get_polygon_rasterizer () const |
Returns the polygon rasterizer setup. More... | |
CL_FrameBuffer | get_write_frame_buffer () const |
Returns the currently selected write frame buffer. More... | |
CL_FrameBuffer | get_read_frame_buffer () const |
Returns the currently selected read frame buffer. More... | |
CL_Pen | get_pen () const |
Returns the currently selected pen. 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... | |
CL_Size | get_size () const |
Returns the current size of the context. More... | |
CL_Rect | get_cliprect () const |
Returns the current clipping rectangle used on the graphic context. More... | |
const CL_Mat4f & | get_modelview () const |
Returns the current effective modelview matrix. More... | |
CL_Size | get_max_texture_size () const |
Returns the maximum size of a texture this graphic context supports. More... | |
CL_GraphicContextProvider * | get_provider () |
Returns the provider for this graphic context. More... | |
const CL_GraphicContextProvider *const | get_provider () const |
Operations | |
CL_PixelBuffer | get_pixeldata (const CL_Rect &rect, CL_TextureFormat pixel_format=cl_abgr8, bool clamp=true) const |
Return the content of the read buffer into a pixel buffer. More... | |
CL_PixelBuffer | get_pixeldata (CL_TextureFormat pixel_format=cl_abgr8, bool clamp=true) const |
Return the content of the read buffer into a pixel buffer. More... | |
void | set_frame_buffer (const CL_FrameBuffer &write_buffer) |
Sets the current frame buffer. More... | |
void | set_frame_buffer (const CL_FrameBuffer &write_buffer, const CL_FrameBuffer &read_buffer) |
void | reset_frame_buffer () |
Resets the current frame buffer to be the initial frame buffer. More... | |
void | set_texture (int unit_index, const CL_Texture &texture) |
Select texture into index. More... | |
void | set_textures (std::vector< CL_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_program_object (CL_StandardProgram standard_program) |
Set active program object to the standard program specified. More... | |
void | set_program_object (const CL_ProgramObject &program, int program_matrix_flags=cl_program_matrix_all_standard) |
Set active program object. More... | |
void | reset_program_object () |
Remove active program object. More... | |
void | set_blend_mode (const CL_BlendMode &blend_mode) |
Set blending modes. More... | |
void | reset_blend_mode () |
Reset blending to the default. More... | |
void | set_buffer_control (const CL_BufferControl &buffer_control) |
Set buffer control states. More... | |
void | reset_buffer_control () |
Set default buffer control states. More... | |
void | set_pen (const CL_Pen &pen) |
Select pen. More... | |
void | reset_pen () |
Reset pen settings to defaults. More... | |
void | set_polygon_rasterizer (const CL_PolygonRasterizer &raster) |
Set polygon rasterizer settings. More... | |
void | reset_polygon_rasterizer () |
Reset polygon rasterizer settings to defaults. More... | |
void | draw_primitives (CL_PrimitivesType type, int num_vertices, const CL_PrimitivesArray &array) |
Draw primitives on gc. More... | |
void | set_primitives_array (const CL_PrimitivesArray &array) |
Set the primitives array on the gc. More... | |
void | draw_primitives_array (CL_PrimitivesType type, int num_vertices) |
Draws primitives from the current assigned primitives array. More... | |
void | draw_primitives_array (CL_PrimitivesType type, int offset, int num_vertices) |
Draw primitives array. More... | |
void | draw_primitives_array_instanced (CL_PrimitivesType type, int offset, int num_vertices, int instance_count) |
Draw primitives array instanced. More... | |
void | draw_primitives_elements (CL_PrimitivesType type, int count, unsigned int *indices) |
Draw primitives elements. More... | |
void | draw_primitives_elements (CL_PrimitivesType type, int count, unsigned short *indices) |
Draw primitives elements. More... | |
void | draw_primitives_elements (CL_PrimitivesType type, int count, unsigned char *indices) |
Draw primitives elements. More... | |
void | draw_primitives_elements (CL_PrimitivesType type, int count, CL_ElementArrayBuffer &element_array, CL_VertexAttributeDataType indices_type, void *offset=0) |
Draw primitives elements. More... | |
void | draw_primitives_elements_instanced (CL_PrimitivesType type, int count, unsigned int *indices, int instance_count) |
Draw primitives elements instanced. More... | |
void | draw_primitives_elements_instanced (CL_PrimitivesType type, int count, unsigned short *indices, int instance_count) |
Draw primitives elements instanced. More... | |
void | draw_primitives_elements_instanced (CL_PrimitivesType type, int count, unsigned char *indices, int instance_count) |
Draw primitives elements instanced. More... | |
void | draw_primitives_elements_instanced (CL_PrimitivesType type, int count, CL_ElementArrayBuffer &element_array, CL_VertexAttributeDataType indices_type, void *offset, int instance_count) |
Draw primitives elements instanced. More... | |
void | reset_primitives_array () |
Reset the primitives arrays. More... | |
void | draw_pixels (float x, float y, const CL_PixelBuffer &pixel_buffer, const CL_Rect &src_rect, const CL_Colorf &color=CL_Colorf::white) |
Draw pixel buffer on gc. More... | |
void | draw_pixels (float x, float y, float zoom_x, float zoom_y, const CL_PixelBuffer &pixel_buffer, const CL_Rect &src_rect, const CL_Colorf &color=CL_Colorf::white) |
Draw pixels. More... | |
void | clear (const CL_Colorf &color=CL_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_cliprect (const CL_Rect &rect) |
Set the current clipping rectangle. More... | |
void | push_cliprect (const CL_Rect &rect) |
Push current clipping rectangle to stack. More... | |
void | push_cliprect () |
Push cliprect. More... | |
void | pop_cliprect () |
Pop current clipping rectangle from the stack. More... | |
void | reset_cliprect () |
Removes the set clipping rectangle and empties the cliprect stack. More... | |
void | set_map_mode (CL_MapMode mode) |
Set the projection mapping mode. More... | |
void | set_viewport (const CL_Rectf &viewport) |
Set the viewport to be used in user projection map mode. More... | |
void | set_projection (const CL_Mat4f &matrix) |
Set the projection matrix to be used in user projection map mode. More... | |
void | set_modelview (const CL_Mat4f &matrix) |
Sets the model view matrix to a new matrix. More... | |
void | mult_modelview (const CL_Mat4f &matrix) |
Multiplies the passed matrix onto the model view matrix. More... | |
void | push_modelview () |
Pushes current model view matrix onto the model view stack. More... | |
void | set_translate (float x, float y, float z=0.0) |
Sets a translate offset matrix, ignoring any earlier model view settings. More... | |
void | mult_translate (float x, float y, float z=0.0) |
Adds the translate offset. More... | |
void | push_translate (float x, float y, float z=0.0) |
Push translation offset onto model view stack. More... | |
void | set_rotate (const CL_Angle &angle, float x=0.0, float y=0.0, float z=1.0, bool normalize=true) |
Sets a rotation matrix, ignoring any earlier model view settings. More... | |
void | mult_rotate (const CL_Angle &angle, float x=0.0, float y=0.0, float z=1.0, bool normalize=true) |
Adds a rotation matrix to existing model view. More... | |
void | push_rotate (const CL_Angle &angle, float x=0.0, float y=0.0, float z=1.0) |
Pushes a rotation matrix onto model view stack. More... | |
void | set_scale (float x, float y, float z=1.0) |
Sets a scale matrix, ignoring any earlier model view settings. More... | |
void | mult_scale (float x, float y, float z=1.0) |
Adds a scale matrix to existing model view. More... | |
void | push_scale (float x, float y, float z=1.0) |
Pushes a scale matrix onto model view stack. More... | |
void | pop_modelview () |
Pops last pushed model view matrix off the stack and makes it the active one. More... | |
void | flush_batcher () |
Flushes the render batcher currently active. More... | |
void | set_batcher (CL_RenderBatcher *batcher) |
Specifies which render batcher is to be currently active. More... | |
Events | |
CL_Signal_v0 & | sig_gc_destruction_imminent () |
Called when the last GC in the thread is about to be destroyed. More... | |
GL1 Graphic Context.
|
inline |
Construction.
CL_GraphicContext_GL1::CL_GraphicContext_GL1 | ( | CL_GraphicContext & | gc) |
Create a GL1 specific graphics context.
CL_GraphicContext_GL1::~CL_GraphicContext_GL1 | ( | ) |
|
inherited |
Clears the whole context using the specified color.
|
inherited |
Clear the depth buffer.
value,: | value to clear to. Range 0.0 - 1.0. |
|
inherited |
Clear the stencil buffer.
value | value to clear to. |
|
inherited |
Draw pixel buffer on gc.
Note, For OpenGL targets this is slow. Consider drawing a texture with a pixelbuffer object (created via CL_PixelBuffer(gc, ...) )
|
inherited |
Draw pixels.
Note, For OpenGL targets this is slow. Consider drawing a texture with a pixelbuffer object (created via CL_PixelBuffer(gc, ...) )
x | = value |
y | = value |
zoom_x | = value |
zoom_y | = value |
pixel_buffer | = Pixel Buffer Ref |
src_rect | = Source rect |
color | = Colorf |
|
inherited |
Draw primitives on gc.
|
inherited |
Draws primitives from the current assigned primitives array.
|
inherited |
Draw primitives array.
type | = Primitives Type |
offset | = value |
num_vertices | = value |
|
inherited |
Draw primitives array instanced.
type | = Primitives Type |
offset | = value |
num_vertices | = value |
instance_count | = number of instances drawn |
|
inherited |
Draw primitives elements.
type | = Primitives Type |
count | = value |
indices | = value |
|
inherited |
Draw primitives elements.
type | = Primitives Type |
count | = value |
indices | = short |
|
inherited |
Draw primitives elements.
type | = Primitives Type |
count | = value |
indices | = char |
|
inherited |
Draw primitives elements.
type | = Primitives Type |
count | = value |
element_array | = Element Array Buffer |
indices_type | = Vertex Attribute Data Type |
offset | = void |
|
inherited |
Draw primitives elements instanced.
type | = Primitives Type |
count | = value |
indices | = value |
instance_count | = number of instances drawn |
|
inherited |
Draw primitives elements instanced.
type | = Primitives Type |
count | = value |
indices | = short |
instance_count | = number of instances drawn |
|
inherited |
Draw primitives elements instanced.
type | = Primitives Type |
count | = value |
indices | = char |
instance_count | = number of instances drawn |
|
inherited |
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 |
|
inherited |
Flushes the render batcher currently active.
|
inherited |
Returns the blending mode description.
|
inherited |
Returns the buffer control description.
|
inherited |
Returns the current clipping rectangle used on the graphic context.
|
inherited |
Returns the current height of the context.
int CL_GraphicContext_GL1::get_light_count | ( | ) |
Get Light count.
int CL_GraphicContext_GL1::get_max_texture_coords | ( | ) |
Get Max texture coords.
|
inherited |
Returns the maximum size of a texture this graphic context supports.
It returns CL_Size(0,0) if there is no known limitation to the max texture size.
|
inherited |
Returns the current effective modelview matrix.
void CL_GraphicContext_GL1::get_opengl_version | ( | int & | version_major, |
int & | version_minor, | ||
int & | version_release | ||
) |
Get the opengl version.
version_major | = On Return: Major |
version_minor | = On Return: Minor |
version_release | = On Return: Release |
|
inherited |
Returns the currently selected pen.
|
inherited |
Return the content of the read buffer into a pixel buffer.
|
inherited |
Return the content of the read buffer into a pixel buffer.
|
inherited |
Returns the polygon rasterizer setup.
|
inherited |
Returns the provider for this graphic context.
|
inherited |
|
inherited |
Returns the currently selected read frame buffer.
|
inherited |
Returns the current size of the context.
|
inherited |
Returns the currently selected texture for the specified index.
index | = 0 to x, the index of the texture |
|
inherited |
Returns the currently selected textures.
|
inherited |
Returns the current width of the context.
|
inherited |
Returns the currently selected write frame buffer.
|
inline |
Attributes.
Returns true if this object is invalid.
|
inherited |
Multiplies the passed matrix onto the model view matrix.
|
inherited |
Adds a rotation matrix to existing model view.
|
inherited |
Adds a scale matrix to existing model view.
|
inherited |
Adds the translate offset.
This offset will affect any subsequent display operations on the current displaycard, by translating the position of the display operation with the offset. The offset will be offset by any previous offsets pushed onto the stack, eg. it inherits the previous offset.
|
inherited |
Pop current clipping rectangle from the stack.
|
inherited |
Pops last pushed model view matrix off the stack and makes it the active one.
void CL_GraphicContext_GL1::pop_texture_matrix | ( | int | unit_index) |
Pop texture matrix.
unit_index | = value |
|
inherited |
Push current clipping rectangle to stack.
If a rectangle is passed, it afterwards sets clipping rectangle to the union of the current rectangle and the passed rectangle.
|
inherited |
Push cliprect.
|
inherited |
Pushes current model view matrix onto the model view stack.
|
inherited |
Pushes a rotation matrix onto model view stack.
|
inherited |
Pushes a scale matrix onto model view stack.
void CL_GraphicContext_GL1::push_texture_matrix | ( | int | unit_index) |
Operations.
Push texture matrix
unit_index | = value |
|
inherited |
Push translation offset onto model view stack.
This function is a convenience function for calling push_modelview, then mult_translate.
This offset will affect any subsequent display operations on the current displaycard, by translating the position of the display operation with the offset. The offset will be offset by any previous offsets pushed onto the stack, eg. it inherits the previous offset.
void CL_GraphicContext_GL1::reset_back_material | ( | ) |
Reset back material.
|
inherited |
Reset blending to the default.
|
inherited |
Set default buffer control states.
|
inherited |
Removes the set clipping rectangle and empties the cliprect stack.
void CL_GraphicContext_GL1::reset_color_material | ( | ) |
Reset color material.
|
inherited |
Resets the current frame buffer to be the initial frame buffer.
void CL_GraphicContext_GL1::reset_front_material | ( | ) |
Reset front material.
void CL_GraphicContext_GL1::reset_light | ( | int | light_index) |
Reset light.
light_index | = value |
void CL_GraphicContext_GL1::reset_light_model | ( | ) |
Reset light model.
void CL_GraphicContext_GL1::reset_material | ( | ) |
Reset material.
|
inherited |
Reset pen settings to defaults.
|
inherited |
Reset polygon rasterizer settings to defaults.
|
inherited |
Reset the primitives arrays.
|
inherited |
Remove active program object.
|
inherited |
Remove texture from index.
unit_index | = 0 to x, the index of the texture |
|
inherited |
Remove all selected textures.
void CL_GraphicContext_GL1::set_active | ( | ) |
Sets the thread's OpenGL context to the one used by the graphic context.
If the CL_FrameBuffer is active, then the OpenGL context will be the OpenGL PBuffer
void CL_GraphicContext_GL1::set_back_material | ( | const CL_Material_GL1 & | material) |
Set back material.
material | = Material_ GL1 |
|
inherited |
Specifies which render batcher is to be currently active.
If the render batcher is already active, nothing happens. If a different render batcher is currently active, it is flushed before the new batcher is made active.
|
inherited |
Set blending modes.
|
inherited |
Set buffer control states.
|
inherited |
Set the current clipping rectangle.
void CL_GraphicContext_GL1::set_color_material | ( | CL_ColorMaterial_GL1 | color) |
Set color material.
color | = Color Material_ GL1 |
void CL_GraphicContext_GL1::set_color_material | ( | GLenum | face, |
CL_ColorMaterial_GL1 | color | ||
) |
Set color material.
face | = GLenum |
color | = Color Material_ GL1 |
void CL_GraphicContext_GL1::set_color_material_back | ( | CL_ColorMaterial_GL1 | color) |
Set color material back.
color | = Color Material_ GL1 |
void CL_GraphicContext_GL1::set_color_material_front | ( | CL_ColorMaterial_GL1 | color) |
Set color material front.
color | = Color Material_ GL1 |
|
inherited |
Sets the current frame buffer.
|
inherited |
void CL_GraphicContext_GL1::set_front_material | ( | const CL_Material_GL1 & | material) |
Set front material.
material | = Material_ GL1 |
void CL_GraphicContext_GL1::set_light | ( | int | light_index, |
const CL_LightSource_GL1 & | light | ||
) |
Set light.
light_index | = value |
light | = Light Source_ GL1 |
void CL_GraphicContext_GL1::set_light_model | ( | const CL_LightModel_GL1 & | light_model) |
Set light model.
light_model | = Light Model_ GL1 |
|
inherited |
Set the projection mapping mode.
void CL_GraphicContext_GL1::set_material | ( | const CL_Material_GL1 & | material) |
Set material.
material | = Material_ GL1 |
void CL_GraphicContext_GL1::set_material | ( | GLenum | face, |
const CL_Material_GL1 & | material | ||
) |
Set material.
face | = GLenum |
material | = Material_ GL1 |
|
inherited |
Sets the model view matrix to a new matrix.
|
inherited |
Select pen.
|
inherited |
Set polygon rasterizer settings.
|
inherited |
Set the primitives array on the gc.
|
inherited |
Set active program object to the standard program specified.
|
inherited |
Set active program object.
program | = Program to set |
program_matrix_flags | = Which matricies will be set in the program object ( CL_ProgramMatrixFlags bitmask flags) |
|
inherited |
Set the projection matrix to be used in user projection map mode.
|
inherited |
Sets a rotation matrix, ignoring any earlier model view settings.
|
inherited |
Sets a scale matrix, ignoring any earlier model view settings.
|
inherited |
Select texture into index.
unit_index | = 0 to x, the index of this texture |
texture | = The texture to select. This can be an empty texture CL_Texture() |
void CL_GraphicContext_GL1::set_texture_matrix | ( | int | unit_index, |
const CL_Mat4f & | matrix | ||
) |
Set texture matrix.
unit_index | = value |
matrix | = Mat4f |
void CL_GraphicContext_GL1::set_texture_unit | ( | int | unit_index, |
const CL_TextureUnit_GL1 & | unit | ||
) |
Set texture unit.
unit_index | = value |
unit | = Texture Unit_ GL1 |
|
inherited |
Select textures.
Only textures units from 0 to textures.size()-1 are set.
textures | = The texture to select (placed at unit_index 0 to texture.size()-1). These may contain null textures |
|
inherited |
Sets a translate offset matrix, ignoring any earlier model view settings.
This offset will affect any subsequent display operations on the current displaycard, by translating the position of the display operation with the offset.
|
inherited |
Set the viewport to be used in user projection map mode.
|
inherited |
Called when the last GC in the thread is about to be destroyed.
void CL_GraphicContext_GL1::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.