Clutter::Cogl(3pm)
NAME
Clutter::Cogl - Abstraction over programmable GPUs
Clutter::Cogl is an abstraction API over GL and GLES, and it is used
internally by Clutter to allow portability between platforms.
The Clutter::Cogl API is low-level and it is meant to be used only when
creating new Clutter::Actor classes.
Clutter::Cogl tries to provide an API that is nicer and more
understandable than the raw OpenGL API (as exposed, for instance, by
the Perl OpenGL wrapper module).
METHODS
- boolean = Clutter::Cogl->get_backface_culling_enabled Clutter::Cogl->set_backface_culling_enabled ($enabled)
- o $enabled (boolean)
- Sets whether textures positioned so that their backface is showing
should be hidden. This can be used to efficiently draw two-sided
textures or fully closed cubes without enabling depth testing. This
only affects calls to the Clutter::Cogl::rectangle* family of functions and Clutter::Cogl::VertexBuffer::draw*. - Backface culling is disabled by default.
- boolean = Clutter::Cogl->check_extension ($name, $ext)
- o $name (string)
- o $ext (string)
- Checks whether name occurs in the list of extensions inside ext
- Clutter::Cogl->clear ($color, $buffers)
- o $color (array of R, G, B, A values)
- o $buffers (Clutter::Cogl::BufferBit)
- Clears all the auxiliary buffers identified in the buffers mask, and if that includes the color buffer then the specified color is used.
- boolean = Clutter::Cogl->get_depth_test_enabled Clutter::Cogl->set_depth_test_enabled ($enabled)
- o $enabled (boolean)
- Sets whether depth testing is enabled. If it is disabled then the order
that actors are layered on the screen depends solely on the order
specified using Clutter::Actor::raise() and Clutter::Actor::lower(), otherwise it will also take into account the actor's depth. - Depth testing is disabled by default.
- Clutter::Cogl->disable_fog boolean = Clutter::Cogl->features_available ($features)
- o $features (Clutter::Cogl::FeatureFlags)
- Checks whether the given features are available.
- featureflags = Clutter::Cogl->get_features
- Retrieves all the features supported by Cogl on the current platform
- Clutter::Cogl->set_fog ($fog_color, $mode, $density, $z_near, $z_far)
- o $fog_color (array of R, G, B, A values)
- o $mode (Clutter::Cogl::FogMode)
- o $density (double)
- o $z_near (double)
- o $z_far (double)
- Enables fogging. Fogging causes vertices that are further away from the
eye to be rendered with a different color. The color is determined
according to the chosen fog mode; at its simplest the color is linearly interpolated so that vertices at z_near are drawn fully with their original color and vertices at z_far are drawn fully with fog_color. Fogging will remain enabled until you call
Clutter::Cogl::disable_fog(). - Note: The fogging functions only work correctly when primitives use
unmultiplied alpha colors. By default Cogl will premultiply textures
and Clutter::Cogl::set_source_color() will premultiply colors, so unless you explicitly load your textures requesting an unmultiplied
internal format and use Clutter::Cogl::Material::set_color() you can only use fogging with fully opaque primitives. This might improve in
the future when we can depend on fragment shaders. - Clutter::Cogl->frustum ($left, $right, $bottom, $top, $z_near, $z_far)
- o $left (double)
- o $right (double)
- o $bottom (double)
- o $top (double)
- o $z_near (double)
- o $z_far (double)
- Replaces the current projection matrix with a perspective matrix for
the given viewing frustum - Clutter::Cogl->ortho ($left, $right, $bottom, $top, $z_near, $z_far)
- o $left (double)
- o $right (double)
- o $bottom (double)
- o $top (double)
- o $z_near (double)
- o $z_far (double)
- Replaces the current projection matrix with a parallel projection
matrix - Clutter::Cogl->perspective ($fovy, $aspect, $z_near, $z_far)
- o $fovy (double)
- o $aspect (double)
- o $z_near (double)
- o $z_far (double)
- Replaces the current projection matrix with a perspective matrix based on the provided values
- Clutter::Cogl->polygon ($vertices, $use_color)
- o $vertices (scalar)
- o $use_color (boolean)
- Clutter::Cogl->pop_matrix
- Restore the current model-view matrix from the matrix stack
- Clutter::Cogl->push_matrix
- Stores the current model-view matrix on the matrix stack. The matrix
can later be restored with Clutter::Cogl->pop_matrix() - Clutter::Cogl->rectangle ($x1, $y1, $x2, $y2)
- o $x1 (double)
- o $y1 (double)
- o $x2 (double)
- o $y2 (double)
- Fills a rectangle at the given coordinates with the current drawing
material in a highly optimizied fashion - Clutter::Cogl->rectangle_with_texture_coords ($x1, $y1, $x2, $y2, $tx1,
- $ty1, $tx2, $ty2)
o $x1 (double) - o $y1 (double)
- o $x2 (double)
- o $y2 (double)
- o $tx1 (double)
- o $ty1 (double)
- o $tx2 (double)
- o $ty2 (double)
- Draw a rectangle using the current material and supply texture
coordinates to be used for the first texture layer of the material. To draw the entire texture pass in tx1=0.0, ty1=0.0, tx2=1.0 and ty2=1.0. - Clutter::Cogl->rectangles ($vertices)
- o $vertices (scalar)
- Draws a series of rectangles in the same way that
Clutter::Cogl::rectangle() does. In some situations it can give a significant performance boost to use this function rather than calling Clutter::Cogl::rectangle() separately for each rectangle. - The vertices array reference should point to an array of floating point
values. Each group of 4 values corresponds to the parameters x1, y1,
x2, and y2, and have the same meaning as in Clutter::Cogl::rectangle(). - Clutter::Cogl->rectangles_with_texture_coords ($vertices)
- o $vertices (scalar)
- Clutter::Cogl->rotate ($angle, $x, $y, $z)
- o $angle (double)
- o $x (double)
- o $y (double)
- o $z (double)
- Multiplies the current model-view matrix by one that rotates the model
around the vertex specified by x, y and z. The rotation follows the
right-hand thumb rule so for example rotating by 10 degrees about the
vertex (0, 0, 1) causes a small counter-clockwise rotation - Clutter::Cogl->scale ($x, $y, $z)
- o $x (double)
- o $y (double)
- o $z (double)
- Multiplies the current model-view matrix by one that scales the x, y and z axes by the given values
- Clutter::Cogl->set_source_color ($color)
- o $color (array of R, G, B, A values)
- This is a convenience function for creating a solid fill source
material from the given color. This color will be used for any subsequent drawing operation. - The color will be premultiplied by Cogl, so the color should be nonpremultiplied. For example: use (1.0, 0.0, 0.0, 0.5) for semitransparent red.
- Clutter::Cogl->set_source ($material)
- o $material (handle)
- This function sets the source material that will be used to fill
subsequent geometry emitted via the cogl API. - Note: in the future we may add the ability to set a front facing material, and a back facing material, in which case this function will set both to the same.
- Clutter::Cogl->set_source_texture ($texture)
- o $texture (handle)
- This is a convenience function for creating a material with the first
layer set to texture and setting that material as the source with Clutter::Cogl::set_source() - Note: There is no interaction between calls to
Clutter::Cogl::set_source_color and
Clutter::Cogl::set_source_texture(). If you need to blend a texture with a color then you can create a simple material like this:
$material = Clutter::Cogl::Material->new ();
$material->set_color (material, (0xff, 0x00, 0x00, 0x80));
$material->set_layer (material, 0, texture);
Clutter::Cogl->set_source ($material); - Clutter::Cogl->translate ($x, $y, $z)
- o $x (double)
- o $y (double)
- o $z (double)
- Multiplies the current model-view matrix by one that translates the
model along all three axes according to the given values - Clutter::Cogl->viewport ($width, $height)
- o $width (integer)
- o $height (integer)
- Replace the current viewport with the given values.
- (x, y, width, height) = Clutter::Cogl->get_viewport
- Retrieves the size of the current viewport
ENUMS AND FLAGS
- flags Clutter::Cogl::BufferBit
- o 'color' / 'COGL_BUFFER_BIT_COLOR'
- o 'depth' / 'COGL_BUFFER_BIT_DEPTH'
- o 'stencil' / 'COGL_BUFFER_BIT_STENCIL'
- flags Clutter::Cogl::FeatureFlags
- o 'texture-rectangle' / 'COGL_FEATURE_TEXTURE_RECTANGLE'
- o 'texture-npot' / 'COGL_FEATURE_TEXTURE_NPOT'
- o 'texture-yuv' / 'COGL_FEATURE_TEXTURE_YUV'
- o 'texture-read-pixels' / 'COGL_FEATURE_TEXTURE_READ_PIXELS'
- o 'shaders-glsl' / 'COGL_FEATURE_SHADERS_GLSL'
- o 'offscreen' / 'COGL_FEATURE_OFFSCREEN'
- o 'offscreen-multisample' / 'COGL_FEATURE_OFFSCREEN_MULTISAMPLE'
- o 'offscreen-blit' / 'COGL_FEATURE_OFFSCREEN_BLIT'
- o 'four-clip-planes' / 'COGL_FEATURE_FOUR_CLIP_PLANES'
- o 'stencil-buffer' / 'COGL_FEATURE_STENCIL_BUFFER'
- o 'vbos' / 'COGL_FEATURE_VBOS'
- enum Clutter::Cogl::FogMode
- o 'linear' / 'COGL_FOG_MODE_LINEAR'
- o 'exponential' / 'COGL_FOG_MODE_EXPONENTIAL'
- o 'exponential-squared' / 'COGL_FOG_MODE_EXPONENTIAL_SQUARED'
SEE ALSO
Clutter
COPYRIGHT
Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
Copyright (C) 2009 Intel Corporation
This module is free software; you can redistribute it and/or modify it
under the terms of either:
o the GNU Lesser General Public Library version 2.1; or
o the Artistic License, version 2.0.
- See Clutter for the full copyright notice.