您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ COGL_TEXTURE函数代码示例

51自学网 2021-06-01 20:03:28
  C++
这篇教程C++ COGL_TEXTURE函数代码示例写得很实用,希望能帮到您。

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

在下文中一共展示了COGL_TEXTURE函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _cogl_texture_2d_gl_get_data

void_cogl_texture_2d_gl_get_data (CoglTexture2D *tex_2d,                              CoglPixelFormat format,                              int rowstride,                              uint8_t *data){  CoglContext *ctx = COGL_TEXTURE (tex_2d)->context;  int bpp;  int width = COGL_TEXTURE (tex_2d)->width;  GLenum gl_format;  GLenum gl_type;  bpp = _cogl_pixel_format_get_bytes_per_pixel (format);  ctx->driver_vtable->pixel_format_to_gl (ctx,                                          format,                                          NULL, /* internal format */                                          &gl_format,                                          &gl_type);  ctx->texture_driver->prep_gl_for_pixels_download (ctx,                                                    rowstride,                                                    width,                                                    bpp);  _cogl_bind_gl_texture_transient (tex_2d->gl_target,                                   tex_2d->gl_texture,                                   tex_2d->is_foreign);  ctx->texture_driver->gl_get_tex_image (ctx,                                         tex_2d->gl_target,                                         gl_format,                                         gl_type,                                         data);}
开发者ID:endlessm,项目名称:mutter,代码行数:35,


示例2: meta_texture_rectangle_new

CoglTexture *meta_texture_rectangle_new (unsigned int width,                            unsigned int height,                            CoglPixelFormat format,                            unsigned int rowstride,                            const guint8 *data){  ClutterBackend *backend =    clutter_get_default_backend ();  CoglContext *context =    clutter_backend_get_cogl_context (backend);  CoglTextureRectangle *tex_rect;  tex_rect = cogl_texture_rectangle_new_with_size (context, width, height);  if (tex_rect == NULL)    return NULL;  if (data)    cogl_texture_set_region (COGL_TEXTURE (tex_rect),                             0, 0, /* src_x/y */                             0, 0, /* dst_x/y */                             width, height, /* dst_width/height */                             width, height, /* width/height */                             format,                             rowstride,                             data);  return COGL_TEXTURE (tex_rect);}
开发者ID:RCcola310,项目名称:mutter,代码行数:29,


示例3: cogl_texture_pixmap_x11_new_right

CoglTexturePixmapX11 *cogl_texture_pixmap_x11_new_right (CoglTexturePixmapX11 *tfp_left){  CoglTexture *texture_left = COGL_TEXTURE (tfp_left);  CoglTexturePixmapX11 *tfp_right;  CoglPixelFormat internal_format;  g_return_val_if_fail (tfp_left->stereo_mode == COGL_TEXTURE_PIXMAP_LEFT, NULL);  tfp_right = g_new0 (CoglTexturePixmapX11, 1);  tfp_right->stereo_mode = COGL_TEXTURE_PIXMAP_RIGHT;  tfp_right->left = cogl_object_ref (tfp_left);  internal_format = (tfp_left->depth >= 32		     ? COGL_PIXEL_FORMAT_RGBA_8888_PRE		     : COGL_PIXEL_FORMAT_RGB_888);  _cogl_texture_init (COGL_TEXTURE (tfp_right),		      texture_left->context,		      texture_left->width,		      texture_left->height,		      internal_format,		      NULL, /* no loader */		      &cogl_texture_pixmap_x11_vtable);  _cogl_texture_set_allocated (COGL_TEXTURE (tfp_right), internal_format,                               texture_left->width, texture_left->height);  return _cogl_texture_pixmap_x11_object_new (tfp_right);}
开发者ID:endlessm,项目名称:mutter,代码行数:29,


示例4: _cogl_texture_2d_gl_generate_mipmap

void_cogl_texture_2d_gl_generate_mipmap (CoglTexture2D *tex_2d){  CoglContext *ctx = COGL_TEXTURE (tex_2d)->context;  /* glGenerateMipmap is defined in the FBO extension. If it's not     available we'll fallback to temporarily enabling     GL_GENERATE_MIPMAP and reuploading the first pixel */  if (cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))    _cogl_texture_gl_generate_mipmaps (COGL_TEXTURE (tex_2d));#ifdef HAVE_COGL_GL  else    {      _cogl_bind_gl_texture_transient (GL_TEXTURE_2D,                                       tex_2d->gl_texture,                                       tex_2d->is_foreign);      GE( ctx, glTexParameteri (GL_TEXTURE_2D,                                GL_GENERATE_MIPMAP,                                GL_TRUE) );      GE( ctx, glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 1, 1,                                tex_2d->first_pixel.gl_format,                                tex_2d->first_pixel.gl_type,                                tex_2d->first_pixel.data) );      GE( ctx, glTexParameteri (GL_TEXTURE_2D,                                GL_GENERATE_MIPMAP,                                GL_FALSE) );    }#endif}
开发者ID:endlessm,项目名称:mutter,代码行数:30,


示例5: _cogl_atlas_create_texture

static CoglTexture2D *_cogl_atlas_create_texture (CoglAtlas *atlas,                            int width,                            int height){  CoglTexture2D *tex;  CoglError *ignore_error = NULL;  _COGL_GET_CONTEXT (ctx, NULL);  if ((atlas->flags & COGL_ATLAS_CLEAR_TEXTURE))    {      uint8_t *clear_data;      CoglBitmap *clear_bmp;      int bpp = _cogl_pixel_format_get_bytes_per_pixel (atlas->texture_format);      /* Create a buffer of zeroes to initially clear the texture */      clear_data = g_malloc0 (width * height * bpp);      clear_bmp = cogl_bitmap_new_for_data (ctx,                                            width,                                            height,                                            atlas->texture_format,                                            width * bpp,                                            clear_data);      tex = cogl_texture_2d_new_from_bitmap (clear_bmp);      _cogl_texture_set_internal_format (COGL_TEXTURE (tex),                                         atlas->texture_format);      if (!cogl_texture_allocate (COGL_TEXTURE (tex), &ignore_error))        {          cogl_error_free (ignore_error);          cogl_object_unref (tex);          tex = NULL;        }      cogl_object_unref (clear_bmp);      g_free (clear_data);    }  else    {      tex = cogl_texture_2d_new_with_size (ctx, width, height);      _cogl_texture_set_internal_format (COGL_TEXTURE (tex),                                         atlas->texture_format);      if (!cogl_texture_allocate (COGL_TEXTURE (tex), &ignore_error))        {          cogl_error_free (ignore_error);          cogl_object_unref (tex);          tex = NULL;        }    }  return tex;}
开发者ID:collinss,项目名称:muffin,代码行数:58,


示例6: _cogl_texture_2d_free

static void_cogl_texture_2d_free (CoglTexture2D *tex_2d){    CoglContext *ctx = COGL_TEXTURE (tex_2d)->context;    ctx->driver_vtable->texture_2d_free (tex_2d);    /* Chain up */    _cogl_texture_free (COGL_TEXTURE (tex_2d));}
开发者ID:rib,项目名称:cogl,代码行数:10,


示例7: cogl_texture_new_with_size

CoglTexture *cogl_texture_new_with_size (CoglContext *ctx,                            int width,			    int height,                            CoglTextureFlags flags,			    CoglPixelFormat internal_format){  CoglTexture *tex;  CoglError *skip_error = NULL;  if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) ||      (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&       cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))    {      /* First try creating a fast-path non-sliced texture */      tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,                                                         width, height,                                                         internal_format));      /* TODO: instead of allocating storage here it would be better       * if we had some api that let us just check that the size is       * supported by the hardware so storage could be allocated       * lazily when uploading data. */      if (!cogl_texture_allocate (tex, &skip_error))        {          cogl_error_free (skip_error);          cogl_object_unref (tex);          tex = NULL;        }    }  else    tex = NULL;  if (tex)    {      CoglBool auto_mipmap = !(flags & COGL_TEXTURE_NO_AUTO_MIPMAP);      cogl_primitive_texture_set_auto_mipmap (COGL_PRIMITIVE_TEXTURE (tex),                                              auto_mipmap);    }  else    {      /* If it fails resort to sliced textures */      int max_waste = flags & COGL_TEXTURE_NO_SLICING ? -1 : COGL_TEXTURE_MAX_WASTE;      cogl_error_free (skip_error);      tex = COGL_TEXTURE (cogl_texture_2d_sliced_new_with_size (ctx,                                                                width,                                                                height,                                                                max_waste,                                                                internal_format));    }  return tex;}
开发者ID:djdeath,项目名称:cogl-android,代码行数:53,


示例8: video_texture_new_from_data

/* This first tries to upload the texture to a CoglTexture2D, but * if that's not possible it falls back to a CoglTexture2DSliced. * * Auto-mipmapping of any uploaded texture is disabled */static CoglTexture *video_texture_new_from_data (CoglContext *ctx,                             int width,                             int height,                             CoglPixelFormat format,                             CoglPixelFormat internal_format,                             int rowstride,                             const uint8_t *data,                             CoglError **error){  CoglBitmap *bitmap;  CoglTexture *tex;  CoglError *internal_error = NULL;  bitmap = cogl_bitmap_new_for_data (ctx,                                     width, height,                                     format,                                     rowstride,                                     (uint8_t *) data);  if ((is_pot (cogl_bitmap_get_width (bitmap)) &&       is_pot (cogl_bitmap_get_height (bitmap))) ||      cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC))    {      tex = COGL_TEXTURE (cogl_texture_2d_new_from_bitmap (bitmap,                                                           internal_format,                                                           &internal_error));      if (!tex)        {          cogl_error_free (internal_error);          internal_error = NULL;        }    }  else    tex = NULL;  if (!tex)    {      /* Otherwise create a sliced texture */      CoglTexture2DSliced *tex_2ds =        cogl_texture_2d_sliced_new_from_bitmap (bitmap,                                                -1, /* no maximum waste */                                                internal_format,                                                error);      tex = COGL_TEXTURE (tex_2ds);    }  cogl_object_unref (bitmap);  return tex;}
开发者ID:gcampax,项目名称:cogl,代码行数:56,


示例9: create_migration_texture

static CoglTexture *create_migration_texture (CoglContext *ctx,                          int width,                          int height,                          CoglPixelFormat internal_format){  CoglTexture *tex;  CoglError *skip_error = NULL;  if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) ||      (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&       cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))    {      /* First try creating a fast-path non-sliced texture */      tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,                                                         width, height));      _cogl_texture_set_internal_format (tex, internal_format);      /* TODO: instead of allocating storage here it would be better       * if we had some api that let us just check that the size is       * supported by the hardware so storage could be allocated       * lazily when uploading data. */      if (!cogl_texture_allocate (tex, &skip_error))        {          cogl_error_free (skip_error);          cogl_object_unref (tex);          tex = NULL;        }    }  else    tex = NULL;  if (!tex)    {      CoglTexture2DSliced *tex_2ds =        cogl_texture_2d_sliced_new_with_size (ctx,                                              width,                                              height,                                              COGL_TEXTURE_MAX_WASTE);      _cogl_texture_set_internal_format (COGL_TEXTURE (tex_2ds),                                         internal_format);      tex = COGL_TEXTURE (tex_2ds);    }  return tex;}
开发者ID:collinss,项目名称:muffin,代码行数:49,


示例10: cogl_pango_glyph_cache_add_to_global_atlas

static gbooleancogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache,                                            PangoFont *font,                                            PangoGlyph glyph,                                            CoglPangoGlyphCacheValue *value){  CoglAtlasTexture *texture;  CoglError *ignore_error = NULL;  if (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SHARED_ATLAS))    return FALSE;  /* If the cache is using mipmapping then we can't use the global     atlas because it would just get migrated back out */  if (cache->use_mipmapping)    return FALSE;  texture = cogl_atlas_texture_new_with_size (cache->ctx,                                              value->draw_width,                                              value->draw_height);  if (!cogl_texture_allocate (COGL_TEXTURE (texture), &ignore_error))    {      cogl_error_free (ignore_error);      return FALSE;    }  value->texture = COGL_TEXTURE (texture);  value->tx1 = 0;  value->ty1 = 0;  value->tx2 = 1;  value->ty2 = 1;  value->tx_pixel = 0;  value->ty_pixel = 0;  /* The first time we store a texture in the global atlas we'll     register for notifications when the global atlas is reorganized     so we can forward the notification on as a glyph     reorganization */  if (!cache->using_global_atlas)    {      _cogl_atlas_texture_add_reorganize_callback        (cache->ctx,         cogl_pango_glyph_cache_reorganize_cb, cache);      cache->using_global_atlas = TRUE;    }  return TRUE;}
开发者ID:GNOME,项目名称:mutter,代码行数:48,


示例11: _cogl_texture_pixmap_x11_free

static void_cogl_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap){  set_damage_object_internal (tex_pixmap, 0, 0);  if (tex_pixmap->image)    XDestroyImage (tex_pixmap->image);  if (tex_pixmap->shm_info.shmid != -1)    {      XShmDetach (_cogl_xlib_get_display (), &tex_pixmap->shm_info);      shmdt (tex_pixmap->shm_info.shmaddr);      shmctl (tex_pixmap->shm_info.shmid, IPC_RMID, 0);    }  if (tex_pixmap->tex)    cogl_handle_unref (tex_pixmap->tex);#ifdef COGL_HAS_GLX_SUPPORT  _cogl_texture_pixmap_x11_free_glx_pixmap (tex_pixmap);  if (tex_pixmap->glx_tex)    cogl_handle_unref (tex_pixmap->glx_tex);#endif  /* Chain up */  _cogl_texture_free (COGL_TEXTURE (tex_pixmap));}
开发者ID:nobled,项目名称:clutter,代码行数:28,


示例12: _cogl_texture_2d_copy_from_framebuffer

void_cogl_texture_2d_copy_from_framebuffer (CoglTexture2D *tex_2d,                                        int src_x,                                        int src_y,                                        int width,                                        int height,                                        CoglFramebuffer *src_fb,                                        int dst_x,                                        int dst_y,                                        int level){    CoglTexture *tex = COGL_TEXTURE (tex_2d);    CoglContext *ctx = tex->context;    /* Assert that the storage for this texture has been allocated */    cogl_texture_allocate (tex, NULL); /* (abort on error) */    ctx->driver_vtable->texture_2d_copy_from_framebuffer (tex_2d,            src_x,            src_y,            width,            height,            src_fb,            dst_x,            dst_y,            level);    tex_2d->mipmaps_dirty = TRUE;}
开发者ID:rib,项目名称:cogl,代码行数:29,


示例13: cogl_wayland_texture_set_region_from_shm_buffer

CoglBoolcogl_wayland_texture_set_region_from_shm_buffer (CoglTexture *texture,        int src_x,        int src_y,        int width,        int height,        struct wl_shm_buffer *        shm_buffer,        int dst_x,        int dst_y,        int level,        CoglError **error){    const uint8_t *data = wl_shm_buffer_get_data (shm_buffer);    int32_t stride = wl_shm_buffer_get_stride (shm_buffer);    CoglPixelFormat format;    int bpp;    shm_buffer_get_cogl_pixel_format (shm_buffer, &format, NULL);    bpp = _cogl_pixel_format_get_bytes_per_pixel (format);    return cogl_texture_set_region (COGL_TEXTURE (texture),                                    width, height,                                    format,                                    stride,                                    data + src_x * bpp + src_y * stride,                                    dst_x, dst_y,                                    level,                                    error);}
开发者ID:rib,项目名称:cogl,代码行数:30,


示例14: _cogl_texture_2d_create_base

static CoglTexture2D *_cogl_texture_2d_create_base (unsigned int     width,                              unsigned int     height,                              CoglTextureFlags flags,                              CoglPixelFormat  internal_format){  CoglTexture2D *tex_2d = g_new (CoglTexture2D, 1);  CoglTexture *tex = COGL_TEXTURE (tex_2d);  tex->vtable = &cogl_texture_2d_vtable;  tex_2d->width = width;  tex_2d->height = height;  tex_2d->mipmaps_dirty = TRUE;  tex_2d->auto_mipmap = (flags & COGL_TEXTURE_NO_AUTO_MIPMAP) == 0;  /* We default to GL_LINEAR for both filters */  tex_2d->min_filter = GL_LINEAR;  tex_2d->mag_filter = GL_LINEAR;  /* Wrap mode not yet set */  tex_2d->wrap_mode = GL_FALSE;  tex_2d->format = internal_format;  return tex_2d;}
开发者ID:gramozeka,项目名称:GSB-NEW,代码行数:27,


示例15: COGL_TEXTURE

CoglTexture *st_cogl_texture_new_from_file_wrapper         (const char *filename,                                         CoglTextureFlags  flags,                                          CoglPixelFormat  internal_format){    CoglTexture *texture = NULL;    CoglError *error = NULL;    if (hardware_supports_npot_sizes ())      {        texture = COGL_TEXTURE (cogl_texture_2d_new_from_file (cogl_context,                                                               filename,#if COGL_VERSION < COGL_VERSION_ENCODE (1, 18, 0)                                                               COGL_PIXEL_FORMAT_ANY,#endif                                                               &error));      }    else      {        texture = cogl_texture_new_from_file (filename,                                              flags,                                              internal_format,                                              &error);      }    if (error)      {        g_debug ("cogl_texture_(2d)_new_from_file failed: %s/n", error->message);        cogl_error_free (error);      }    return texture;}
开发者ID:AlbertJP,项目名称:Cinnamon,代码行数:33,


示例16: COGL_TEXTURE

CoglTexture *meta_cogl_texture_new_from_data_wrapper                (int  width,                                                        int  height,                                           CoglTextureFlags  flags,                                            CoglPixelFormat  format,                                            CoglPixelFormat  internal_format,                                                        int  rowstride,                                              const uint8_t *data){    CoglTexture *texture = NULL;    if (hardware_supports_npot_sizes ())      {        texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (cogl_context, width, height,                                                               format,#if COGL_VERSION < COGL_VERSION_ENCODE (1, 18, 0)                                                               COGL_PIXEL_FORMAT_ANY,#endif                                                               rowstride,                                                               data,                                                               NULL));      }    else      {        texture = cogl_texture_new_from_data (width,                                              height,                                              flags,                                              format,                                              internal_format,                                              rowstride,                                              data);      }    return texture;}
开发者ID:koulin,项目名称:muffin,代码行数:35,


示例17: _cogl_texture_pixmap_x11_free

static void_cogl_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap){  _COGL_GET_CONTEXT (ctxt, NO_RETVAL);  set_damage_object_internal (ctxt, tex_pixmap, 0, 0);  if (tex_pixmap->image)    XDestroyImage (tex_pixmap->image);  if (tex_pixmap->shm_info.shmid != -1)    {      XShmDetach (cogl_xlib_get_display (), &tex_pixmap->shm_info);      shmdt (tex_pixmap->shm_info.shmaddr);      shmctl (tex_pixmap->shm_info.shmid, IPC_RMID, 0);    }  if (tex_pixmap->tex)    cogl_handle_unref (tex_pixmap->tex);  if (tex_pixmap->winsys)    {      const CoglWinsysVtable *winsys =        _cogl_texture_pixmap_x11_get_winsys (tex_pixmap);      winsys->texture_pixmap_x11_free (tex_pixmap);    }  /* Chain up */  _cogl_texture_free (COGL_TEXTURE (tex_pixmap));}
开发者ID:spatulasnout,项目名称:cogl,代码行数:30,


示例18: _cogl_texture_rectangle_create_base

static CoglTextureRectangle *_cogl_texture_rectangle_create_base (CoglContext *ctx,                                     int width,                                     int height,                                     CoglPixelFormat internal_format,                                     CoglTextureLoader *loader){  CoglTextureRectangle *tex_rect = g_new (CoglTextureRectangle, 1);  CoglTexture *tex = COGL_TEXTURE (tex_rect);  _cogl_texture_init (tex, ctx, width, height,                      internal_format, loader,                      &cogl_texture_rectangle_vtable);  tex_rect->gl_texture = 0;  tex_rect->is_foreign = FALSE;  /* We default to GL_LINEAR for both filters */  tex_rect->gl_legacy_texobj_min_filter = GL_LINEAR;  tex_rect->gl_legacy_texobj_mag_filter = GL_LINEAR;  /* Wrap mode not yet set */  tex_rect->gl_legacy_texobj_wrap_mode_s = GL_FALSE;  tex_rect->gl_legacy_texobj_wrap_mode_t = GL_FALSE;  return _cogl_texture_rectangle_object_new (tex_rect);}
开发者ID:rib,项目名称:cogl,代码行数:27,


示例19: _cogl_texture_2d_gl_copy_from_framebuffer

void_cogl_texture_2d_gl_copy_from_framebuffer (CoglTexture2D *tex_2d,                                           int src_x,                                           int src_y,                                           int width,                                           int height,                                           CoglFramebuffer *src_fb,                                           int dst_x,                                           int dst_y,                                           int level){  CoglTexture *tex = COGL_TEXTURE (tex_2d);  CoglContext *ctx = tex->context;  /* Make sure the current framebuffers are bound, though we don't need to   * flush the clip state here since we aren't going to draw to the   * framebuffer. */  _cogl_framebuffer_flush_state (ctx->current_draw_buffer,                                 src_fb,                                 COGL_FRAMEBUFFER_STATE_ALL &                                 ~COGL_FRAMEBUFFER_STATE_CLIP);  _cogl_bind_gl_texture_transient (GL_TEXTURE_2D,                                   tex_2d->gl_texture,                                   tex_2d->is_foreign);  ctx->glCopyTexSubImage2D (GL_TEXTURE_2D,                            0, /* level */                            dst_x, dst_y,                            src_x, src_y,                            width, height);}
开发者ID:endlessm,项目名称:mutter,代码行数:32,


示例20: _cogl_sub_texture_map_quad

static void_cogl_sub_texture_map_quad (CoglSubTexture *sub_tex,                            float *coords){  CoglTexture *tex = COGL_TEXTURE (sub_tex);  /* NB: coords[] always come in as normalized coordinates but may go   * out as non-normalized if sub_tex->full_texture is a   * CoglTextureRectangle.   *   * NB: sub_tex->sub_x/y/width/height are in non-normalized   * coordinates.   */  if (cogl_is_texture_rectangle (sub_tex->full_texture))    {      coords[0] = coords[0] * tex->width + sub_tex->sub_x;      coords[1] = coords[1] * tex->height + sub_tex->sub_y;      coords[2] = coords[2] * tex->width + sub_tex->sub_x;      coords[3] = coords[3] * tex->height + sub_tex->sub_y;    }  else    {      float width = cogl_texture_get_width (sub_tex->full_texture);      float height = cogl_texture_get_height (sub_tex->full_texture);      coords[0] = (coords[0] * tex->width + sub_tex->sub_x) / width;      coords[1] = (coords[1] * tex->height + sub_tex->sub_y) / height;      coords[2] = (coords[2] * tex->width + sub_tex->sub_x) / width;      coords[3] = (coords[3] * tex->height + sub_tex->sub_y) / height;    }}
开发者ID:rib,项目名称:cogl,代码行数:31,


示例21: _cogl_sub_texture_unmap_quad

static void_cogl_sub_texture_unmap_quad (CoglSubTexture *sub_tex,                              float *coords){  CoglTexture *tex = COGL_TEXTURE (sub_tex);  /* NB: coords[] come in as non-normalized if sub_tex->full_texture   * is a CoglTextureRectangle otherwhise they are normalized. The   * coordinates we write out though must always be normalized.   *   * NB: sub_tex->sub_x/y/width/height are in non-normalized   * coordinates.   */  if (cogl_is_texture_rectangle (sub_tex->full_texture))    {      coords[0] = (coords[0] - sub_tex->sub_x) / tex->width;      coords[1] = (coords[1] - sub_tex->sub_y) / tex->height;      coords[2] = (coords[2] - sub_tex->sub_x) / tex->width;      coords[3] = (coords[3] - sub_tex->sub_y) / tex->height;    }  else    {      float width = cogl_texture_get_width (sub_tex->full_texture);      float height = cogl_texture_get_height (sub_tex->full_texture);      coords[0] = (coords[0] * width - sub_tex->sub_x) / tex->width;      coords[1] = (coords[1] * height - sub_tex->sub_y) / tex->height;      coords[2] = (coords[2] * width - sub_tex->sub_x) / tex->width;      coords[3] = (coords[3] * height - sub_tex->sub_y) / tex->height;    }}
开发者ID:rib,项目名称:cogl,代码行数:30,


示例22: _cogl_texture_get_gl_format

GLenum_cogl_texture_get_gl_format (CoglHandle handle){  CoglTexture *tex = COGL_TEXTURE (handle);  return tex->vtable->get_gl_format (tex);}
开发者ID:nobled,项目名称:clutter,代码行数:7,


示例23: _st_create_shadow_pipeline

CoglPipeline *_st_create_shadow_pipeline (StShadow    *shadow_spec,                            CoglTexture *src_texture){    ClutterBackend *backend = clutter_get_default_backend ();    CoglContext *ctx = clutter_backend_get_cogl_context (backend);    static CoglPipeline *shadow_pipeline_template = NULL;    CoglPipeline *pipeline;    CoglTexture *texture;    guchar *pixels_in, *pixels_out;    gint width_in, height_in, rowstride_in;    gint width_out, height_out, rowstride_out;    g_return_val_if_fail (shadow_spec != NULL, NULL);    g_return_val_if_fail (src_texture != NULL, NULL);    width_in  = cogl_texture_get_width  (src_texture);    height_in = cogl_texture_get_height (src_texture);    rowstride_in = (width_in + 3) & ~3;    pixels_in  = g_malloc0 (rowstride_in * height_in);    cogl_texture_get_data (src_texture, COGL_PIXEL_FORMAT_A_8,                           rowstride_in, pixels_in);    pixels_out = blur_pixels (pixels_in, width_in, height_in, rowstride_in,                              shadow_spec->blur,                              &width_out, &height_out, &rowstride_out);    g_free (pixels_in);    texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width_out, height_out,                            COGL_PIXEL_FORMAT_A_8,                            rowstride_out,                            pixels_out,                            NULL));    g_free (pixels_out);    if (G_UNLIKELY (shadow_pipeline_template == NULL))    {        CoglContext *ctx =            clutter_backend_get_cogl_context (clutter_get_default_backend ());        shadow_pipeline_template = cogl_pipeline_new (ctx);        /* We set up the pipeline to blend the shadow texture with the combine         * constant, but defer setting the latter until painting, so that we can         * take the actor's overall opacity into account. */        cogl_pipeline_set_layer_combine (shadow_pipeline_template, 0,                                         "RGBA = MODULATE (CONSTANT, TEXTURE[A])",                                         NULL);    }    pipeline = cogl_pipeline_copy (shadow_pipeline_template);    cogl_pipeline_set_layer_texture (pipeline, 0, texture);    cogl_object_unref (texture);    return pipeline;}
开发者ID:meetparikh7,项目名称:gnome-shell,代码行数:60,


示例24: create_gles2_context

static voidcreate_gles2_context (CoglTexture **offscreen_texture,                      CoglOffscreen **offscreen,                      CoglPipeline **pipeline,                      CoglGLES2Context **gles2_ctx,                      const CoglGLES2Vtable **gles2){  GError *error = NULL;  *offscreen_texture = COGL_TEXTURE (    cogl_texture_2d_new_with_size (test_ctx,                                   cogl_framebuffer_get_width (test_fb),                                   cogl_framebuffer_get_height (test_fb),                                   COGL_PIXEL_FORMAT_ANY,                                   NULL));  *offscreen = cogl_offscreen_new_to_texture (*offscreen_texture);  *pipeline = cogl_pipeline_new (test_ctx);  cogl_pipeline_set_layer_texture (*pipeline, 0, *offscreen_texture);  *gles2_ctx = cogl_gles2_context_new (test_ctx, NULL);  if (!*gles2_ctx)    g_error ("Failed to create GLES2 context: %s/n", error->message);  *gles2 = cogl_gles2_context_get_vtable (*gles2_ctx);}
开发者ID:ChrisCummins,项目名称:cogl,代码行数:26,


示例25: _cogl_texture_3d_create_base

static CoglTexture3D *_cogl_texture_3d_create_base (CoglContext *ctx,                              int width,                              int height,                              int depth,                              CoglPixelFormat internal_format,                              CoglTextureLoader *loader){  CoglTexture3D *tex_3d = g_new (CoglTexture3D, 1);  CoglTexture *tex = COGL_TEXTURE (tex_3d);  _cogl_texture_init (tex, ctx, width, height,                      internal_format, loader, &cogl_texture_3d_vtable);  tex_3d->gl_texture = 0;  tex_3d->depth = depth;  tex_3d->mipmaps_dirty = TRUE;  tex_3d->auto_mipmap = TRUE;  /* We default to GL_LINEAR for both filters */  tex_3d->gl_legacy_texobj_min_filter = GL_LINEAR;  tex_3d->gl_legacy_texobj_mag_filter = GL_LINEAR;  /* Wrap mode not yet set */  tex_3d->gl_legacy_texobj_wrap_mode_s = GL_FALSE;  tex_3d->gl_legacy_texobj_wrap_mode_t = GL_FALSE;  tex_3d->gl_legacy_texobj_wrap_mode_p = GL_FALSE;  return _cogl_texture_3d_object_new (tex_3d);}
开发者ID:collinss,项目名称:muffin,代码行数:31,


示例26: meta_cursor_sprite_get_cogl_texture

CoglTexture *meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *sprite){  MetaCursorSpritePrivate *priv =    meta_cursor_sprite_get_instance_private (sprite);  return COGL_TEXTURE (priv->texture);}
开发者ID:endlessm,项目名称:mutter,代码行数:8,


示例27: _cogl_texture_transform_quad_coords_to_gl

CoglTransformResult_cogl_texture_transform_quad_coords_to_gl (CoglHandle handle,                                           float *coords){  CoglTexture *tex = COGL_TEXTURE (handle);  return tex->vtable->transform_quad_coords_to_gl (tex, coords);}
开发者ID:nobled,项目名称:clutter,代码行数:8,



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


C++ COLA_ASSERT函数代码示例
C++ COGL_FRAMEBUFFER函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。