• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cogl_get_draw_framebuffer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cogl_get_draw_framebuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ cogl_get_draw_framebuffer函数的具体用法?C++ cogl_get_draw_framebuffer怎么用?C++ cogl_get_draw_framebuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cogl_get_draw_framebuffer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:collinss,项目名称:muffin,代码行数:59,代码来源:cogl.c


示例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);
}
开发者ID:AOSC-Dev,项目名称:elsa-shell,代码行数:30,代码来源:switcher.c


示例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);
}
开发者ID:collects,项目名称:cogl,代码行数:28,代码来源:cogl2-path.c


示例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);
}
开发者ID:collects,项目名称:cogl,代码行数:26,代码来源:cogl2-path.c


示例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);
}
开发者ID:meetparikh7,项目名称:gnome-shell,代码行数:26,代码来源:st-private.c


示例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);
}
开发者ID:collects,项目名称:cogl,代码行数:8,代码来源:cogl.c


示例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);
}
开发者ID:endlessm,项目名称:mutter,代码行数:58,代码来源:meta-surface-actor.c


示例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);
}
开发者ID:collinss,项目名称:muffin,代码行数:9,代码来源:cogl.c


示例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;
    }
}
开发者ID:kelsieflynn,项目名称:mutter,代码行数:56,代码来源:compositor.c


示例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 */);
}
开发者ID:collinss,项目名称:muffin,代码行数:14,代码来源:cogl-path.c


示例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);
}
开发者ID:collinss,项目名称:muffin,代码行数:14,代码来源:cogl.c


示例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);
}
开发者ID:collinss,项目名称:muffin,代码行数:11,代码来源:cogl.c


示例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);
}
开发者ID:collinss,项目名称:muffin,代码行数:11,代码来源:cogl.c


示例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);
}
开发者ID:MaximeMorel,项目名称:mutter,代码行数:11,代码来源:cogl-primitives.c


示例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 ());
}
开发者ID:collinss,项目名称:muffin,代码行数:16,代码来源:cogl-path.c


示例16: cogl_clip_stack_restore

void
cogl_clip_stack_restore (void)
{
  CoglFramebuffer *framebuffer;
  CoglClipState *clip_state;

  _COGL_GET_CONTEXT (ctx, NO_RETVAL);

  framebuffer = cogl_get_draw_framebuffer ();
  clip_state = _cogl_framebuffer_get_clip_state (framebuffer);

  _cogl_clip_stack_restore_real (clip_state);
}
开发者ID:spatulasnout,项目名称:cogl,代码行数:13,代码来源:cogl-clip-state.c


示例17: cogl_clip_ensure

/* XXX: This should never have been made public API! */
void
cogl_clip_ensure (void)
{
  CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
  CoglClipState *clip_state;

  clip_state = _cogl_framebuffer_get_clip_state (framebuffer);
  /* Flushing the clip state doesn't cause the journal to be
     flushed. This function may be being called by an external
     application however so it makes sense to flush the journal
     here */
  _cogl_framebuffer_flush_journal (framebuffer);
  _cogl_clip_state_flush (clip_state);
}
开发者ID:spatulasnout,项目名称:cogl,代码行数:15,代码来源:cogl-clip-state.c


示例18: _cogl_path_stroke_nodes

static void
_cogl_path_stroke_nodes (CoglPath *path)
{
  CoglPathData *data = path->data;
  CoglPipeline *copy = NULL;
  CoglPipeline *source;
  unsigned int path_start;
  int path_num = 0;
  CoglPathNode *node;

  _COGL_GET_CONTEXT (ctx, NO_RETVAL);

  source = cogl_get_source ();

  if (cogl_pipeline_get_n_layers (source) != 0)
    {
      copy = cogl_pipeline_copy (source);
      _cogl_pipeline_prune_to_n_layers (copy, 0);
      source = copy;
    }

  _cogl_path_build_stroke_attribute_buffer (path);

  cogl_push_source (source);

  for (path_start = 0;
       path_start < data->path_nodes->len;
       path_start += node->path_size)
    {
      node = &g_array_index (data->path_nodes, CoglPathNode, path_start);

      cogl_framebuffer_vdraw_attributes (cogl_get_draw_framebuffer (),
                                         source,
                                         COGL_VERTICES_MODE_LINE_STRIP,
                                         0, node->path_size,
                                         data->stroke_attributes[path_num],
                                         NULL);

      path_num++;
    }

  cogl_pop_source ();

  if (copy)
    cogl_object_unref (copy);
}
开发者ID:collects,项目名称:cogl,代码行数:46,代码来源:cogl2-path.c


示例19: cogl_set_viewport

void
cogl_set_viewport (int x,
                   int y,
                   int width,
                   int height)
{
  CoglFramebuffer *framebuffer;

  _COGL_GET_CONTEXT (ctx, NO_RETVAL);

  framebuffer = cogl_get_draw_framebuffer ();

  cogl_framebuffer_set_viewport (framebuffer,
                                 x,
                                 y,
                                 width,
                                 height);
}
开发者ID:collinss,项目名称:muffin,代码行数:18,代码来源:cogl.c


示例20: cogl_clip_push_window_rectangle

void
cogl_clip_push_window_rectangle (int x_offset,
                                 int y_offset,
                                 int width,
                                 int height)
{
  CoglFramebuffer *framebuffer;
  CoglClipState *clip_state;

  _COGL_GET_CONTEXT (ctx, NO_RETVAL);

  framebuffer = cogl_get_draw_framebuffer ();
  clip_state = _cogl_framebuffer_get_clip_state (framebuffer);

  clip_state->stacks->data =
    _cogl_clip_stack_push_window_rectangle (clip_state->stacks->data,
                                            x_offset, y_offset,
                                            width, height);
}
开发者ID:spatulasnout,项目名称:cogl,代码行数:19,代码来源:cogl-clip-state.c



注:本文中的cogl_get_draw_framebuffer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cogl_handle_unref函数代码示例发布时间:2022-05-30
下一篇:
C++ coerceVector函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap