本文整理汇总了C++中cogl_pipeline_new函数的典型用法代码示例。如果您正苦于以下问题:C++ cogl_pipeline_new函数的具体用法?C++ cogl_pipeline_new怎么用?C++ cogl_pipeline_new使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cogl_pipeline_new函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _clutter_paint_node_init_types
/*< private >
* _clutter_paint_node_init_types:
*
* Initializes the required types for ClutterPaintNode subclasses
*/
void
_clutter_paint_node_init_types (void)
{
CoglContext *ctx;
CoglColor cogl_color;
GType node_type G_GNUC_UNUSED;
if (G_LIKELY (default_color_pipeline != NULL))
return;
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
node_type = clutter_paint_node_get_type ();
cogl_color_init_from_4f (&cogl_color, 1.0, 1.0, 1.0, 1.0);
default_color_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_color (default_color_pipeline, &cogl_color);
default_texture_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_layer_null_texture (default_texture_pipeline, 0,
COGL_TEXTURE_TYPE_2D);
cogl_pipeline_set_color (default_texture_pipeline, &cogl_color);
cogl_pipeline_set_layer_wrap_mode (default_texture_pipeline, 0,
COGL_PIPELINE_WRAP_MODE_AUTOMATIC);
}
开发者ID:endlessm,项目名称:mutter,代码行数:31,代码来源:clutter-paint-nodes.c
示例2: paint
static void
paint (TestState *state)
{
CoglPipeline *white = cogl_pipeline_new (test_ctx);
int i;
cogl_pipeline_set_color4f (white, 1, 1, 1, 1);
cogl_framebuffer_draw_rectangle (state->fbo[0],
white,
-1.0, -1.0, 1.0, 1.0);
cogl_framebuffer_draw_rectangle (state->fbo[1],
white,
-1.0, -1.0, 1.0, 1.0);
cogl_framebuffer_draw_rectangle (state->fbo[2],
white,
-1.0, -1.0, 1.0, 1.0);
cogl_object_unref (white);
cogl_framebuffer_clear4f (test_fb,
COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH,
0.5, 0.5, 0.5, 1.0);
/* Render all of the textures to the screen */
for (i = 0; i < NUM_FBOS; i++)
{
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
cogl_pipeline_set_layer_texture (pipeline, 0, state->tex[i]);
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
2.0f / NUM_FBOS * i - 1.0f, -1.0f,
2.0f / NUM_FBOS * (i + 1) - 1.0f, 1.0f);
cogl_object_unref (pipeline);
}
/* Verify all of the fbos drew the right color */
for (i = 0; i < NUM_FBOS; i++)
{
uint8_t expected_colors[NUM_FBOS][4] =
{ { 0xff, 0x00, 0x00, 0xff },
{ 0x00, 0xff, 0x00, 0xff },
{ 0x00, 0x00, 0xff, 0xff } };
test_utils_check_pixel_rgb (test_fb,
state->width * (i + 0.5f) / NUM_FBOS,
state->height / 2,
expected_colors[i][0],
expected_colors[i][1],
expected_colors[i][2]);
}
}
开发者ID:gcampax,项目名称:cogl,代码行数:54,代码来源:test-color-mask.c
示例3: ImGui_ImplGtk3Cogl_CreateDeviceObjects
bool ImGui_ImplGtk3Cogl_CreateDeviceObjects()
{
g_ColorPipeline = cogl_pipeline_new(g_Context);
g_ImagePipeline = cogl_pipeline_new(g_Context);
CoglError *error = NULL;
if (!cogl_pipeline_set_blend(g_ColorPipeline,
"RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))"
"A = ADD(SRC_COLOR[A], DST_COLOR*(1-SRC_COLOR[A]))",
&error))
{
g_warning("Blending: %s", error->message);
g_error_free(error);
return false;
}
cogl_pipeline_set_cull_face_mode(g_ColorPipeline, COGL_PIPELINE_CULL_FACE_MODE_NONE);
CoglDepthState depth_state;
cogl_depth_state_init(&depth_state);
cogl_depth_state_set_test_enabled(&depth_state, FALSE);
if (!cogl_pipeline_set_depth_state(g_ColorPipeline, &depth_state, &error))
{
g_warning("Depth: %s", error->message);
g_error_free(error);
return false;
}
if (!cogl_pipeline_set_blend(g_ImagePipeline,
"RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))"
"A = ADD(SRC_COLOR[A], DST_COLOR*(1-SRC_COLOR[A]))",
&error))
{
g_warning("Blending: %s", error->message);
g_error_free(error);
return false;
}
cogl_pipeline_set_cull_face_mode(g_ImagePipeline, COGL_PIPELINE_CULL_FACE_MODE_NONE);
if (!cogl_pipeline_set_depth_state(g_ImagePipeline, &depth_state, &error))
{
g_warning("Depth: %s", error->message);
g_error_free(error);
return false;
}
ImGui_ImplGtk3Cogl_CreateFontsTexture();
/* Disable depth buffer since we're not using it. */
//cogl_framebuffer_set_depth_write_enabled(g_Framebuffer, FALSE);
return true;
}
开发者ID:Katackae,项目名称:gputop,代码行数:53,代码来源:imgui_impl_gtk3_cogl.cpp
示例4: paint_scene
static void
paint_scene (RigPaintContext *paint_ctx)
{
RutPaintContext *rut_paint_ctx = &paint_ctx->_parent;
RigEngine *engine = paint_ctx->engine;
CoglContext *ctx = engine->ctx->cogl_context;
CoglFramebuffer *fb = rut_camera_get_framebuffer (rut_paint_ctx->camera);
if (paint_ctx->pass == RIG_PASS_COLOR_UNBLENDED)
{
CoglPipeline *pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_color4f (pipeline,
engine->background_color.red,
engine->background_color.green,
engine->background_color.blue,
engine->background_color.alpha);
cogl_framebuffer_draw_rectangle (fb,
pipeline,
0, 0,
engine->device_width, engine->device_height);
//0, 0, engine->pane_width, engine->pane_height);
cogl_object_unref (pipeline);
}
rut_graphable_traverse (engine->scene,
RUT_TRAVERSE_DEPTH_FIRST,
entitygraph_pre_paint_cb,
entitygraph_post_paint_cb,
paint_ctx);
rig_journal_flush (engine->journal, paint_ctx);
}
开发者ID:sanyaade-mobiledev,项目名称:rig,代码行数:32,代码来源:rig-renderer.c
示例5: test_path_clip
void
test_path_clip (void)
{
CoglPath *path;
CoglPipeline *pipeline;
int fb_width, fb_height;
fb_width = cogl_framebuffer_get_width (test_fb);
fb_height = cogl_framebuffer_get_height (test_fb);
cogl_framebuffer_orthographic (test_fb,
0, 0, fb_width, fb_height, -1, 100);
path = cogl_path_new ();
cogl_framebuffer_clear4f (test_fb,
COGL_BUFFER_BIT_COLOR,
1.0f, 0.0f, 0.0f, 1.0f);
/* Make an L-shape with the top right corner left untouched */
cogl_path_move_to (path, 0, fb_height);
cogl_path_line_to (path, fb_width, fb_height);
cogl_path_line_to (path, fb_width, fb_height / 2);
cogl_path_line_to (path, fb_width / 2, fb_height / 2);
cogl_path_line_to (path, fb_width / 2, 0);
cogl_path_line_to (path, 0, 0);
cogl_path_close (path);
cogl_framebuffer_push_path_clip (test_fb, path);
/* Try to fill the framebuffer with a blue rectangle. This should be
* clipped to leave the top right quadrant as is */
pipeline = cogl_pipeline_new (test_ctx);
cogl_pipeline_set_color4ub (pipeline, 0, 0, 255, 255);
cogl_framebuffer_draw_rectangle (test_fb,
pipeline,
0, 0, fb_width, fb_height);
cogl_framebuffer_pop_clip (test_fb);
cogl_object_unref (pipeline);
cogl_object_unref (path);
/* Check each of the four quadrants */
test_utils_check_pixel (test_fb,
fb_width / 4, fb_height / 4,
0x0000ffff);
test_utils_check_pixel (test_fb,
fb_width * 3 / 4, fb_height / 4,
0xff0000ff);
test_utils_check_pixel (test_fb,
fb_width / 4, fb_height * 3 / 4,
0x0000ffff);
test_utils_check_pixel (test_fb,
fb_width * 3 / 4, fb_height * 3 / 4,
0x0000ffff);
if (cogl_test_verbose ())
g_print ("OK\n");
}
开发者ID:collinss,项目名称:muffin,代码行数:60,代码来源:test-path-clip.c
示例6: rig_selection_tool_new
RigSelectionTool *
rig_selection_tool_new (RigCameraView *view,
RutObject *overlay)
{
RigSelectionTool *tool = g_slice_new0 (RigSelectionTool);
RutContext *ctx = view->context;
tool->view = view;
tool->ctx = ctx;
/* Note: we don't take a reference on this overlay to avoid creating
* a circular reference. */
tool->tool_overlay = overlay;
tool->camera = view->view_camera;
tool->camera_component =
rut_entity_get_component (tool->camera, RUT_COMPONENT_TYPE_CAMERA);
rut_list_init (&tool->selection_event_cb_list);
/* pipeline to draw the tool */
tool->default_pipeline = cogl_pipeline_new (rut_cogl_context);
return tool;
}
开发者ID:cee1,项目名称:rig,代码行数:25,代码来源:rig-selection-tool.c
示例7: test_custom_attributes
void
test_custom_attributes (void)
{
/* If shaders aren't supported then we can't run the test */
if (cogl_has_feature (test_ctx, COGL_FEATURE_ID_GLSL))
{
CoglSnippet *snippet;
TestState state;
cogl_framebuffer_orthographic (test_fb,
0, 0,
cogl_framebuffer_get_width (test_fb),
cogl_framebuffer_get_height (test_fb),
-1,
100);
state.pipeline = cogl_pipeline_new (test_ctx);
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
"attribute vec4 color;",
"cogl_color_out = color;");
cogl_pipeline_add_snippet (state.pipeline, snippet);
paint (&state);
cogl_object_unref (state.pipeline);
cogl_object_unref (snippet);
if (cogl_test_verbose ())
g_print ("OK\n");
}
else if (cogl_test_verbose ())
g_print ("Skipping\n");
}
开发者ID:ChrisCummins,项目名称:cogl,代码行数:33,代码来源:test-custom-attributes.c
示例8: rut_rectangle_new4f
RutRectangle *
rut_rectangle_new4f (RutContext *ctx,
float width,
float height,
float red,
float green,
float blue,
float alpha)
{
RutRectangle *rectangle = g_slice_new0 (RutRectangle);
static CoglBool initialized = FALSE;
if (initialized == FALSE)
{
_rut_rectangle_init_type ();
initialized = TRUE;
}
rut_object_init (&rectangle->_parent, &rut_rectangle_type);
rectangle->ref_count = 1;
rut_graphable_init (rectangle);
rut_paintable_init (rectangle);
rectangle->width = width;
rectangle->height = height;
rectangle->pipeline = cogl_pipeline_new (ctx->cogl_context);
cogl_pipeline_set_color4f (rectangle->pipeline,
red, green, blue, alpha);
return rectangle;
}
开发者ID:cee1,项目名称:rig,代码行数:34,代码来源:rut-rectangle.c
示例9: create_two_layer_pipeline
static CoglPipeline *
create_two_layer_pipeline (void)
{
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
CoglColor color;
/* The pipeline is initially black */
cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255);
/* The first layer adds a full red component */
cogl_color_init_from_4ub (&color, 255, 0, 0, 255);
cogl_pipeline_set_layer_combine_constant (pipeline, 0, &color);
cogl_pipeline_set_layer_combine (pipeline,
0, /* layer_num */
"RGBA=ADD(PREVIOUS,CONSTANT)",
NULL);
/* The second layer adds a full green component */
cogl_color_init_from_4ub (&color, 0, 255, 0, 255);
cogl_pipeline_set_layer_combine_constant (pipeline, 1, &color);
cogl_pipeline_set_layer_combine (pipeline,
1, /* layer_num */
"RGBA=ADD(PREVIOUS,CONSTANT)",
NULL);
return pipeline;
}
开发者ID:endlessm,项目名称:mutter,代码行数:27,代码来源:test-layer-remove.c
示例10: meta_overlay_init
static void
meta_overlay_init (MetaOverlay *overlay)
{
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
overlay->pipeline = cogl_pipeline_new (ctx);
}
开发者ID:brownsr,项目名称:mutter,代码行数:7,代码来源:meta-stage.c
示例11: cogl_gst_video_sink_get_pipeline
CoglPipeline *
cogl_gst_video_sink_get_pipeline (CoglGstVideoSink *vt)
{
CoglGstVideoSinkPrivate *priv;
g_return_val_if_fail (COGL_GST_IS_VIDEO_SINK (vt), NULL);
priv = vt->priv;
if (priv->pipeline == NULL)
{
priv->pipeline = cogl_pipeline_new (priv->ctx);
cogl_gst_video_sink_setup_pipeline (vt, priv->pipeline);
cogl_gst_video_sink_attach_frame (vt, priv->pipeline);
priv->frame_dirty = FALSE;
}
else if (priv->frame_dirty)
{
CoglPipeline *pipeline = cogl_pipeline_copy (priv->pipeline);
cogl_object_unref (priv->pipeline);
priv->pipeline = pipeline;
cogl_gst_video_sink_attach_frame (vt, pipeline);
priv->frame_dirty = FALSE;
}
return priv->pipeline;
}
开发者ID:gcampax,项目名称:cogl,代码行数:28,代码来源:cogl-gst-video-sink.c
示例12: test_custom_attributes
void
test_custom_attributes (void)
{
CoglSnippet *snippet;
TestState state;
cogl_framebuffer_orthographic (test_fb,
0, 0,
cogl_framebuffer_get_width (test_fb),
cogl_framebuffer_get_height (test_fb),
-1,
100);
state.pipeline = cogl_pipeline_new (test_ctx);
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
"attribute vec4 color;",
"cogl_color_out = color;");
cogl_pipeline_add_snippet (state.pipeline, snippet);
paint (&state);
cogl_object_unref (state.pipeline);
cogl_object_unref (snippet);
if (cogl_test_verbose ())
g_print ("OK\n");
}
开发者ID:3v1n0,项目名称:cogl,代码行数:27,代码来源:test-custom-attributes.c
示例13: _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,代码来源:st-private.c
示例14: shell_anamorphosis_effect_init
static void
shell_anamorphosis_effect_init (ShellAnamorphosisEffect *self)
{
static CoglPipeline *pipeline_template;
ShellAnamorphosisEffectPrivate *priv = shell_anamorphosis_effect_get_instance_private (self);
if (G_UNLIKELY (pipeline_template == NULL))
{
CoglSnippet *snippet;
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
pipeline_template = cogl_pipeline_new (ctx);
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP, anamorphosis_decls, NULL);
cogl_snippet_set_pre (snippet, anamorphosis_pre);
cogl_pipeline_add_layer_snippet (pipeline_template, 0, snippet);
cogl_object_unref (snippet);
cogl_pipeline_set_layer_null_texture (pipeline_template,
0, /* layer number */
COGL_TEXTURE_TYPE_2D);
}
priv->pipeline = cogl_pipeline_copy (pipeline_template);
priv->tex_width_uniform = cogl_pipeline_get_uniform_location (priv->pipeline, "tex_width");
priv->tex_height_uniform = cogl_pipeline_get_uniform_location (priv->pipeline, "tex_height");
priv->_x_uniform = cogl_pipeline_get_uniform_location (priv->pipeline, "_x");
priv->_y_uniform = cogl_pipeline_get_uniform_location (priv->pipeline, "_y");
priv->_z_uniform = cogl_pipeline_get_uniform_location (priv->pipeline, "_z");
update_uniforms (self);
}
开发者ID:ErwanDouaille,项目名称:Lille1-Master-Info,代码行数:33,代码来源:shell-anamorphosis-effect.c
示例15: clutter_colorize_effect_init
static void
clutter_colorize_effect_init (ClutterColorizeEffect *self)
{
ClutterColorizeEffectClass *klass = CLUTTER_COLORIZE_EFFECT_GET_CLASS (self);
if (G_UNLIKELY (klass->base_pipeline == NULL))
{
CoglSnippet *snippet;
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
klass->base_pipeline = cogl_pipeline_new (ctx);
snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
colorize_glsl_declarations,
colorize_glsl_source);
cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
cogl_object_unref (snippet);
cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
}
self->pipeline = cogl_pipeline_copy (klass->base_pipeline);
self->tint_uniform =
cogl_pipeline_get_uniform_location (self->pipeline, "tint");
self->tint = default_tint;
update_tint_uniform (self);
}
开发者ID:GNOME,项目名称:mutter,代码行数:31,代码来源:clutter-colorize-effect.c
示例16: paint
static void
paint (TestState *state)
{
CoglPipeline *pipeline;
paint_test_backface_culling (state, test_fb);
/*
* Now repeat the test but rendered to an offscreen
* framebuffer. Note that by default the conformance tests are
* always run to an offscreen buffer but we might as well have this
* check anyway in case it is being run with COGL_TEST_ONSCREEN=1
*/
paint_test_backface_culling (state, state->offscreen);
/* Copy the result of the offscreen rendering for validation and
* also so we can have visual feedback. */
pipeline = cogl_pipeline_new (test_ctx);
cogl_pipeline_set_layer_texture (pipeline, 0, state->offscreen_tex);
cogl_framebuffer_draw_rectangle (test_fb,
pipeline,
0, TEXTURE_RENDER_SIZE * 16,
state->width,
state->height + TEXTURE_RENDER_SIZE * 16);
cogl_object_unref (pipeline);
validate_result (test_fb, 0);
validate_result (test_fb, 16);
}
开发者ID:ChrisCummins,项目名称:cogl,代码行数:29,代码来源:test-backface-culling.c
示例17: create_pipelines
static void
create_pipelines (CoglPipeline **pipelines,
int n_pipelines)
{
int i;
for (i = 0; i < n_pipelines; i++)
{
char *source = g_strdup_printf (" cogl_color_out = "
"vec4 (%f, 0.0, 0.0, 1.0);\n",
i / 255.0f);
CoglSnippet *snippet =
cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
NULL, /* declarations */
source);
g_free (source);
pipelines[i] = cogl_pipeline_new (test_ctx);
cogl_pipeline_add_snippet (pipelines[i], snippet);
cogl_object_unref (snippet);
}
/* Test that drawing with them works. This should create the entries
* in the cache */
for (i = 0; i < n_pipelines; i++)
{
cogl_framebuffer_draw_rectangle (test_fb,
pipelines[i],
i, 0,
i + 1, 1);
test_utils_check_pixel_rgb (test_fb, i, 0, i, 0, 0);
}
}
开发者ID:GNOME,项目名称:mutter,代码行数:35,代码来源:cogl-pipeline-cache.c
示例18: create_gles2_context
static void
create_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,代码来源:test-gles2-context.c
示例19: _st_create_texture_pipeline
/**
* _st_create_texture_pipeline:
* @src_texture: The CoglTexture for the pipeline
*
* Creates a simple pipeline which contains the given texture as a
* single layer.
*/
CoglPipeline *
_st_create_texture_pipeline (CoglTexture *src_texture)
{
static CoglPipeline *texture_pipeline_template = NULL;
CoglPipeline *pipeline;
g_return_val_if_fail (src_texture != NULL, NULL);
/* The only state used in the pipeline that would affect the shader
generation is the texture type on the layer. Therefore we create
a template pipeline which sets this state and all texture
pipelines are created as a copy of this. That way Cogl can find
the shader state for the pipeline more quickly by looking at the
pipeline ancestry instead of resorting to the shader cache. */
if (G_UNLIKELY (texture_pipeline_template == NULL))
{
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
texture_pipeline_template = cogl_pipeline_new (ctx);
cogl_pipeline_set_layer_null_texture (texture_pipeline_template,
0, /* layer */
COGL_TEXTURE_TYPE_2D);
}
pipeline = cogl_pipeline_copy (texture_pipeline_template);
if (src_texture != NULL)
cogl_pipeline_set_layer_texture (pipeline, 0, src_texture);
return pipeline;
}
开发者ID:meetparikh7,项目名称:gnome-shell,代码行数:39,代码来源:st-private.c
示例20: shell_glsl_quad_constructed
static void
shell_glsl_quad_constructed (GObject *object)
{
ShellGLSLQuad *self;
ShellGLSLQuadClass *klass;
ShellGLSLQuadPrivate *priv;
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
G_OBJECT_CLASS (shell_glsl_quad_parent_class)->constructed (object);
/* Note that, differently from ClutterBlurEffect, we are calling
this inside constructed, not init, so klass points to the most-derived
GTypeClass, not ShellGLSLQuadClass.
*/
klass = SHELL_GLSL_QUAD_GET_CLASS (object);
self = SHELL_GLSL_QUAD (object);
priv = shell_glsl_quad_get_instance_private (self);
if (G_UNLIKELY (klass->base_pipeline == NULL))
{
klass->base_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_blend (klass->base_pipeline, "RGBA = ADD (SRC_COLOR * (SRC_COLOR[A]), DST_COLOR * (1-SRC_COLOR[A]))", NULL);
if (klass->build_pipeline != NULL)
klass->build_pipeline (self);
}
priv->pipeline = cogl_pipeline_copy (klass->base_pipeline);
cogl_pipeline_set_layer_null_texture (priv->pipeline, 0, COGL_TEXTURE_TYPE_2D);
}
开发者ID:SamKeightley,项目名称:gnome-shell,代码行数:32,代码来源:shell-glsl-quad.c
注:本文中的cogl_pipeline_new函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论