Method

CoglPipelineset_user_program

Declaration [src]

void
cogl_pipeline_set_user_program (
  CoglPipeline* pipeline,
  CoglHandle program
)

Description [src]

Associates a linked CoglProgram with the given pipeline so that the program can take full control of vertex and/or fragment processing.

This is an example of how it can be used to associate an ARBfp program with a CoglPipeline:

CoglHandle shader;
CoglHandle program;
CoglPipeline *pipeline;

shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
cogl_shader_source (shader,
                    "!!ARBfp1.0\n"
                    "MOV result.color,fragment.color;\n"
                    "END\n");

program = cogl_create_program ();
cogl_program_attach_shader (program, shader);
cogl_program_link (program);

pipeline = cogl_pipeline_new ();
cogl_pipeline_set_user_program (pipeline, program);

cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_rectangle (0, 0, 100, 100);

It is possibly worth keeping in mind that this API is not part of the long term design for how we want to expose shaders to Cogl developers (We are planning on deprecating the cogl_program and cogl_shader APIs in favour of a “snippet” framework) but in the meantime we hope this will handle most practical GLSL and ARBfp requirements.

Stability:Unstable
Available since:2.0

Parameters

program CoglHandle
 

A CoglHandle to a linked CoglProgram.