本文整理汇总了C++中cogl_get_draw_framebuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ cogl_get_draw_framebuffer函数的具体用法?C++ cogl_get_draw_framebuffer怎么用?C++ cogl_get_draw_framebuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cogl_get_draw_framebuffer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cogl_begin_gl
void
cogl_begin_gl (void)
{
CoglPipeline *pipeline;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (ctx->in_begin_gl_block)
{
static CoglBool shown = FALSE;
if (!shown)
g_warning ("You should not nest cogl_begin_gl/cogl_end_gl blocks");
shown = TRUE;
return;
}
ctx->in_begin_gl_block = TRUE;
/* Flush all batched primitives */
cogl_flush ();
/* Flush framebuffer state, including clip state, modelview and
* projection matrix state
*
* NB: _cogl_framebuffer_flush_state may disrupt various state (such
* as the pipeline state) when flushing the clip stack, so should
* always be done first when preparing to draw. */
_cogl_framebuffer_flush_state (cogl_get_draw_framebuffer (),
_cogl_get_read_framebuffer (),
COGL_FRAMEBUFFER_STATE_ALL);
/* Setup the state for the current pipeline */
/* We considered flushing a specific, minimal pipeline here to try and
* simplify the GL state, but decided to avoid special cases and second
* guessing what would be actually helpful.
*
* A user should instead call cogl_set_source_color4ub() before
* cogl_begin_gl() to simplify the state flushed.
*
* XXX: note defining n_tex_coord_attribs using
* cogl_pipeline_get_n_layers is a hack, but the problem is that
* n_tex_coord_attribs is usually defined when drawing a primitive
* which isn't happening here.
*
* Maybe it would be more useful if this code did flush the
* opaque_color_pipeline and then call into cogl-pipeline-opengl.c to then
* restore all state for the material's backend back to default OpenGL
* values.
*/
pipeline = cogl_get_source ();
_cogl_pipeline_flush_gl_state (ctx,
pipeline,
cogl_get_draw_framebuffer (),
FALSE,
FALSE);
/* Disable any cached vertex arrays */
_cogl_gl_disable_all_attributes (ctx);
}
示例2: _capture_desktop
static void _capture_desktop(MetaSwitcher* self)
{
MetaSwitcherPrivate* priv = self->priv;
MetaScreen* screen = meta_plugin_get_screen(priv->plugin);
ClutterActor* stage = meta_get_stage_for_screen(screen);
gfloat tx, ty, w, h;
clutter_actor_get_position(priv->top, &tx, &ty);
clutter_actor_get_size(priv->top, &w, &h);
g_debug("%s: %f, %f, %f, %f", __func__, tx, ty, w, h);
if (priv->snapshot) {
cairo_surface_destroy(priv->snapshot);
priv->snapshot = NULL;
}
priv->snapshot_offset = 20.0;
w += priv->snapshot_offset*3;
clutter_stage_ensure_redraw(CLUTTER_STAGE(stage));
guchar* data = g_malloc(w*h*4);
cogl_framebuffer_read_pixels(cogl_get_draw_framebuffer(),
tx-priv->snapshot_offset, ty, w, h,
CLUTTER_CAIRO_FORMAT_ARGB32, data);
/*guchar* data = clutter_stage_read_pixels(CLUTTER_STAGE(stage), */
/*tx-priv->snapshot_offset, ty, w, h);*/
priv->snapshot = cairo_image_surface_create_for_data(data,
CAIRO_FORMAT_ARGB32, w, h, w*4);
g_free(data);
}
示例3: _cogl_path_fill_nodes_with_clipped_rectangle
static void
_cogl_path_fill_nodes_with_clipped_rectangle (CoglPath *path)
{
CoglFramebuffer *fb;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (!(ctx->private_feature_flags & COGL_PRIVATE_FEATURE_STENCIL_BUFFER))
{
static gboolean seen_warning = FALSE;
if (!seen_warning)
{
g_warning ("Paths can not be filled using materials with "
"sliced textures unless there is a stencil "
"buffer");
seen_warning = TRUE;
}
}
fb = cogl_get_draw_framebuffer ();
cogl_framebuffer_push_path_clip (fb, path);
cogl_rectangle (path->data->path_nodes_min.x,
path->data->path_nodes_min.y,
path->data->path_nodes_max.x,
path->data->path_nodes_max.y);
cogl_framebuffer_pop_clip (fb);
}
示例4: _cogl_path_fill_nodes
void
_cogl_path_fill_nodes (CoglPath *path, CoglDrawFlags flags)
{
gboolean needs_fallback = FALSE;
CoglPipeline *pipeline = cogl_get_source ();
_cogl_pipeline_foreach_layer_internal (pipeline,
validate_layer_cb, &needs_fallback);
if (needs_fallback)
{
_cogl_path_fill_nodes_with_clipped_rectangle (path);
return;
}
_cogl_path_build_fill_attribute_buffer (path);
_cogl_framebuffer_draw_indexed_attributes (cogl_get_draw_framebuffer (),
pipeline,
COGL_VERTICES_MODE_TRIANGLES,
0, /* first_vertex */
path->data->fill_vbo_n_indices,
path->data->fill_vbo_indices,
path->data->fill_attributes,
COGL_PATH_N_ATTRIBUTES,
flags);
}
示例5: _st_paint_shadow_with_opacity
void
_st_paint_shadow_with_opacity (StShadow *shadow_spec,
CoglPipeline *shadow_pipeline,
ClutterActorBox *box,
guint8 paint_opacity)
{
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
ClutterActorBox shadow_box;
CoglColor color;
g_return_if_fail (shadow_spec != NULL);
g_return_if_fail (shadow_pipeline != NULL);
st_shadow_get_box (shadow_spec, box, &shadow_box);
cogl_color_init_from_4ub (&color,
shadow_spec->color.red * paint_opacity / 255,
shadow_spec->color.green * paint_opacity / 255,
shadow_spec->color.blue * paint_opacity / 255,
shadow_spec->color.alpha * paint_opacity / 255);
cogl_color_premultiply (&color);
cogl_pipeline_set_layer_combine_constant (shadow_pipeline, 0, &color);
cogl_framebuffer_draw_rectangle (fb, shadow_pipeline,
shadow_box.x1, shadow_box.y1,
shadow_box.x2, shadow_box.y2);
}
示例6: _cogl_get_clip_state
CoglClipState *
_cogl_get_clip_state (void)
{
CoglFramebuffer *framebuffer;
framebuffer = cogl_get_draw_framebuffer ();
return _cogl_framebuffer_get_clip_state (framebuffer);
}
示例7: meta_surface_actor_pick
static void
meta_surface_actor_pick (ClutterActor *actor,
const ClutterColor *color)
{
MetaSurfaceActor *self = META_SURFACE_ACTOR (actor);
MetaSurfaceActorPrivate *priv =
meta_surface_actor_get_instance_private (self);
ClutterActorIter iter;
ClutterActor *child;
if (!clutter_actor_should_pick_paint (actor))
return;
/* If there is no region then use the regular pick */
if (priv->input_region == NULL)
CLUTTER_ACTOR_CLASS (meta_surface_actor_parent_class)->pick (actor, color);
else
{
int n_rects;
float *rectangles;
int i;
CoglPipeline *pipeline;
CoglContext *ctx;
CoglFramebuffer *fb;
CoglColor cogl_color;
n_rects = cairo_region_num_rectangles (priv->input_region);
rectangles = g_alloca (sizeof (float) * 4 * n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
int pos = i * 4;
cairo_region_get_rectangle (priv->input_region, i, &rect);
rectangles[pos + 0] = rect.x;
rectangles[pos + 1] = rect.y;
rectangles[pos + 2] = rect.x + rect.width;
rectangles[pos + 3] = rect.y + rect.height;
}
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
fb = cogl_get_draw_framebuffer ();
cogl_color_init_from_4ub (&cogl_color, color->red, color->green, color->blue, color->alpha);
pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_color (pipeline, &cogl_color);
cogl_framebuffer_draw_rectangles (fb, pipeline, rectangles, n_rects);
cogl_object_unref (pipeline);
}
clutter_actor_iter_init (&iter, actor);
while (clutter_actor_iter_next (&iter, &child))
clutter_actor_paint (child);
}
示例8: cogl_perspective
void
cogl_perspective (float fov_y,
float aspect,
float z_near,
float z_far)
{
cogl_framebuffer_perspective (cogl_get_draw_framebuffer (),
fov_y, aspect, z_near, z_far);
}
示例9: pre_paint_windows
static void
pre_paint_windows (MetaCompositor *compositor)
{
GList *l;
MetaWindowActor *top_window;
if (compositor->onscreen == NULL)
{
compositor->onscreen = COGL_ONSCREEN (cogl_get_draw_framebuffer ());
compositor->frame_closure = cogl_onscreen_add_frame_callback (compositor->onscreen,
frame_callback,
compositor,
NULL);
}
if (compositor->windows == NULL)
return;
top_window = g_list_last (compositor->windows)->data;
if (meta_window_actor_should_unredirect (top_window) &&
compositor->disable_unredirect_count == 0)
set_unredirected_window (compositor, meta_window_actor_get_meta_window (top_window));
else
set_unredirected_window (compositor, NULL);
for (l = compositor->windows; l; l = l->next)
meta_window_actor_pre_paint (l->data);
if (compositor->frame_has_updated_xsurfaces)
{
/* We need to make sure that any X drawing that happens before
* the XDamageSubtract() for each window above is visible to
* subsequent GL rendering; the only standardized way to do this
* is EXT_x11_sync_object, which isn't yet widely available. For
* now, we count on details of Xorg and the open source drivers,
* and hope for the best otherwise.
*
* Xorg and open source driver specifics:
*
* The X server makes sure to flush drawing to the kernel before
* sending out damage events, but since we use
* DamageReportBoundingBox there may be drawing between the last
* damage event and the XDamageSubtract() that needs to be
* flushed as well.
*
* Xorg always makes sure that drawing is flushed to the kernel
* before writing events or responses to the client, so any
* round trip request at this point is sufficient to flush the
* GLX buffers.
*/
XSync (compositor->display->xdisplay, False);
compositor->frame_has_updated_xsurfaces = FALSE;
}
}
示例10: cogl2_path_fill
/* TODO: Update to the protoype used in the Cogl master branch.
* This is experimental API but not in sync with the cogl_path_fill()
* api in Cogl master which takes explicit framebuffer and pipeline
* arguments */
void
cogl2_path_fill (CoglPath *path)
{
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
_cogl_path_fill_nodes (path,
cogl_get_draw_framebuffer (),
cogl_get_source (),
0 /* flags */);
}
示例11: cogl_get_viewport
/* XXX: This function should either be replaced with one returning
* integers, or removed/deprecated and make the
* _cogl_framebuffer_get_viewport* functions public.
*/
void
cogl_get_viewport (float viewport[4])
{
CoglFramebuffer *framebuffer;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
framebuffer = cogl_get_draw_framebuffer ();
cogl_framebuffer_get_viewport4fv (framebuffer, viewport);
}
示例12: cogl_frustum
void
cogl_frustum (float left,
float right,
float bottom,
float top,
float z_near,
float z_far)
{
cogl_framebuffer_frustum (cogl_get_draw_framebuffer (),
left, right, bottom, top, z_near, z_far);
}
示例13: cogl_ortho
void
cogl_ortho (float left,
float right,
float bottom,
float top,
float near,
float far)
{
cogl_framebuffer_orthographic (cogl_get_draw_framebuffer (),
left, top, right, bottom, near, far);
}
示例14: _cogl_rectangles_with_multitexture_coords
static void
_cogl_rectangles_with_multitexture_coords (
CoglMultiTexturedRect *rects,
int n_rects)
{
_cogl_framebuffer_draw_multitextured_rectangles (cogl_get_draw_framebuffer (),
cogl_get_source (),
rects,
n_rects,
FALSE);
}
示例15: cogl2_path_stroke
/* TODO: Update to the protoype used in the Cogl master branch.
* This is experimental API but not in sync with the cogl_path_fill()
* api in Cogl master which takes explicit framebuffer and pipeline
* arguments */
void
cogl2_path_stroke (CoglPath *path)
{
_COGL_RETURN_IF_FAIL (cogl_is_path (path));
if (path->data->path_nodes->len == 0)
return;
_cogl_path_stroke_nodes (path,
cogl_get_draw_framebuffer (),
cogl_get_source ());
}