![]() |
![]() |
![]() |
COGL 0.8.2 Reference Manual | ![]() |
---|---|---|---|---|
#define COGL_PIXEL_FORMAT_24 #define COGL_PIXEL_FORMAT_32 #define COGL_A_BIT #define COGL_BGR_BIT #define COGL_AFIRST_BIT #define COGL_PREMULT_BIT #define COGL_UNORDERED_MASK #define COGL_UNPREMULT_MASK enum CoglPixelFormat; enum CoglBufferTarget; void cogl_perspective (ClutterFixed fovy, ClutterFixed aspect, ClutterFixed z_near, ClutterFixed z_far); void cogl_frustum (ClutterFixed left, ClutterFixed right, ClutterFixed bottom, ClutterFixed top, ClutterFixed z_near, ClutterFixed z_far); void cogl_setup_viewport (guint width, guint height, ClutterFixed fovy, ClutterFixed aspect, ClutterFixed z_near, ClutterFixed z_far); void cogl_viewport (guint width, guint height); void cogl_get_modelview_matrix (ClutterFixed m[16]); void cogl_get_projection_matrix (ClutterFixed m[16]); void cogl_get_viewport (ClutterFixed v[4]); void cogl_push_matrix (void); void cogl_pop_matrix (void); void cogl_scale (ClutterFixed x, ClutterFixed y); void cogl_translatex (ClutterFixed x, ClutterFixed y, ClutterFixed z); void cogl_translate (gint x, gint y, gint z); void cogl_rotatex (ClutterFixed angle, gint x, gint y, gint z); void cogl_rotate (gint angle, gint x, gint y, gint z); void cogl_clip_set (ClutterFixed x_offset, ClutterFixed y_offset, ClutterFixed width, ClutterFixed height); void cogl_clip_unset (void); void cogl_clip_stack_save (void); void cogl_clip_stack_restore (void); void cogl_enable_depth_test (gboolean setting); void cogl_alpha_func (COGLenum func, ClutterFixed ref); void cogl_fog_set (const ClutterColor *fog_color, ClutterFixed density, ClutterFixed z_near, ClutterFixed z_far);
typedef enum { COGL_PIXEL_FORMAT_ANY = 0, COGL_PIXEL_FORMAT_A_8 = 1 | COGL_A_BIT, COGL_PIXEL_FORMAT_RGB_565 = 4, COGL_PIXEL_FORMAT_RGBA_4444 = 5 | COGL_A_BIT, COGL_PIXEL_FORMAT_RGBA_5551 = 6 | COGL_A_BIT, COGL_PIXEL_FORMAT_YUV = 7, COGL_PIXEL_FORMAT_G_8 = 8, COGL_PIXEL_FORMAT_RGB_888 = COGL_PIXEL_FORMAT_24, COGL_PIXEL_FORMAT_BGR_888 = (COGL_PIXEL_FORMAT_24 | COGL_BGR_BIT), COGL_PIXEL_FORMAT_RGBA_8888 = COGL_PIXEL_FORMAT_32 | COGL_A_BIT, COGL_PIXEL_FORMAT_BGRA_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_BGR_BIT), COGL_PIXEL_FORMAT_ARGB_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_AFIRST_BIT), COGL_PIXEL_FORMAT_ABGR_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT), COGL_PIXEL_FORMAT_RGBA_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT), COGL_PIXEL_FORMAT_BGRA_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT), COGL_PIXEL_FORMAT_ARGB_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT), COGL_PIXEL_FORMAT_ABGR_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT), COGL_PIXEL_FORMAT_RGBA_4444_PRE = (COGL_PIXEL_FORMAT_RGBA_4444 | COGL_A_BIT | COGL_PREMULT_BIT), COGL_PIXEL_FORMAT_RGBA_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT), } CoglPixelFormat;
Pixel formats used by COGL.
typedef enum { COGL_WINDOW_BUFFER = (1 << 1), COGL_MASK_BUFFER = (1 << 2), COGL_OFFSCREEN_BUFFER = (1 << 3) } CoglBufferTarget;
void cogl_perspective (ClutterFixed fovy, ClutterFixed aspect, ClutterFixed z_near, ClutterFixed z_far);
Replaces the current projection matrix with a perspective matrix based on the provided values.
|
Vertical of view angle in degrees. |
|
Aspect ratio of diesplay |
|
Nearest visible point |
|
Furthest visible point along the z-axis |
void cogl_frustum (ClutterFixed left, ClutterFixed right, ClutterFixed bottom, ClutterFixed top, ClutterFixed z_near, ClutterFixed z_far);
Replaces the current projection matrix with a perspective matrix for the given viewing frustum.
|
Left clipping plane |
|
Right clipping plane |
|
Bottom clipping plane |
|
Top clipping plane |
|
Nearest visible point |
|
Furthest visible point along the z-axis |
Since 0.8.2
void cogl_setup_viewport (guint width, guint height, ClutterFixed fovy, ClutterFixed aspect, ClutterFixed z_near, ClutterFixed z_far);
Replaces the current viewport and projection matrix with the given
values. The viewport is placed at the top left corner of the window
with the given width and height. The projection matrix is replaced
with one that has a viewing angle of fovy
along the y-axis and a
view scaled according to aspect
along the x-axis. The view is
clipped according to z_near
and z_far
on the z-axis.
|
Width of the viewport |
|
Height of the viewport |
|
Field of view angle in degrees |
|
Aspect ratio to determine the field of view along the x-axis |
|
Nearest visible point along the z-axis |
|
Furthest visible point along the z-axis |
void cogl_viewport (guint width, guint height);
Replace the current viewport with the given values.
|
Width of the viewport |
|
Height of the viewport |
Since 0.8.2
void cogl_get_modelview_matrix (ClutterFixed m[16]);
Stores the current model-view matrix in m
. The matrix is in
column-major order.
|
pointer to a 4x4 array of ClutterFixeds to receive the matrix |
void cogl_get_projection_matrix (ClutterFixed m[16]);
Stores the current projection matrix in m
. The matrix is in
column-major order.
|
pointer to a 4x4 array of ClutterFixeds to receive the matrix |
void cogl_get_viewport (ClutterFixed v[4]);
Stores the current viewport in v
. v
[0] and v
[1] get the x and y
position of the viewport and v
[2] and v
[3] get the width and
height.
|
pointer to a 4 element array of ClutterFixeds to receive the viewport dimensions. |
void cogl_push_matrix (void);
Store the current model-view matrix on the matrix stack. The matrix
can later be restored with cogl_pop_matrix()
.
void cogl_pop_matrix (void);
Restore the current model-view matrix from the matrix stack.
void cogl_scale (ClutterFixed x, ClutterFixed y);
Multiplies the current model-view matrix by one that scales the x and y axes by the given values.
|
Amount to scale along the x-axis |
|
Amount to scale along the y-axis |
void cogl_translatex (ClutterFixed x, ClutterFixed y, ClutterFixed z);
Multiplies the current model-view matrix by one that translates the model along all three axes according to the given values.
|
Distance to translate along the x-axis |
|
Distance to translate along the y-axis |
|
Distance to translate along the z-axis |
void cogl_translate (gint x, gint y, gint z);
Integer version of cogl_translatex()
. Multiplies the current
model-view matrix by one that translates the model along all three
axes according to the given values.
|
Distance to translate along the x-axis |
|
Distance to translate along the y-axis |
|
Distance to translate along the z-axis |
void cogl_rotatex (ClutterFixed angle, gint x, gint y, gint z);
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.
|
Angle in degrees to rotate. |
|
X-component of vertex to rotate around. |
|
Y-component of vertex to rotate around. |
|
Z-component of vertex to rotate around. |
void cogl_rotate (gint angle, gint x, gint y, gint z);
Integer version of cogl_rotatex()
. Multiplies the current
model-view matrix by one that rotates the model around the vertex
specified by x
, y
and z
.
|
Angle in degrees to rotate. |
|
X-component of vertex to rotate around. |
|
Y-component of vertex to rotate around. |
|
Z-component of vertex to rotate around. |
void cogl_clip_set (ClutterFixed x_offset, ClutterFixed y_offset, ClutterFixed width, ClutterFixed height);
Specifies a rectangular clipping area for all subsequent drawing operations. Any drawing commands that extend outside the rectangle will be clipped so that only the portion inside the rectangle will be displayed. The rectangle dimensions are transformed by the current model-view matrix.
|
left edge of the clip rectangle |
|
top edge of the clip rectangle |
|
width of the clip rectangle |
|
height of the clip rectangle |
void cogl_clip_unset (void);
Removes the current clipping rectangle so that all drawing operations extend to full size of the viewport again.
void cogl_clip_stack_save (void);
Save the entire state of the clipping stack and then clear all
clipping. The previous state can be returned to with
cogl_clip_stack_restore()
. Each call to cogl_clip_set()
after this
must be matched by a call to cogl_clip_unset()
before calling
cogl_clip_stack_restore()
.
Since 0.8.2
void cogl_clip_stack_restore (void);
Restore the state of the clipping stack that was previously saved
by cogl_clip_stack_save()
.
Since 0.8.2
void cogl_enable_depth_test (gboolean setting);
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.
void cogl_alpha_func (COGLenum func, ClutterFixed ref);
Changes the alpha test to use the specified function specified in func
,
comparing with the value in ref
. The default function is CGL_ALWAYS the
initial reference value is 1.0.
|
the comparison function to use, one of CGL_NEVER, CGL_LESS, CGL_EQUAL, CGL_LEQUAL, CGL_GREATER, CGL_NOTEQUAL, CGL_GEQUAL and GL_ALWAYS. |
|
reference value. |
void cogl_fog_set (const ClutterColor *fog_color, ClutterFixed density, ClutterFixed z_near, ClutterFixed z_far);
Enables fogging. Fogging causes vertices that are further away from
the eye to be rendered with a different color. 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 the next call to
cogl_paint_init()
.
|
The color of the fog |
|
Ignored |
|
Position along z-axis where no fogging should be applied |
|
Position along z-axes where full fogging should be applied |