diff options
-rw-r--r-- | cogl/cogl-glsl-shader-boilerplate.h | 4 | ||||
-rw-r--r-- | cogl/cogl-snippet.h | 13 | ||||
-rw-r--r-- | cogl/driver/gl/cogl-pipeline-fragend-glsl.c | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/cogl/cogl-glsl-shader-boilerplate.h b/cogl/cogl-glsl-shader-boilerplate.h index 99c1dbc9..798149e7 100644 --- a/cogl/cogl-glsl-shader-boilerplate.h +++ b/cogl/cogl-glsl-shader-boilerplate.h @@ -64,7 +64,9 @@ "#define cogl_color_out gl_FragColor\n" \ "#define cogl_depth_out gl_FragDepth\n" \ "\n" \ - "#define cogl_front_facing gl_FrontFacing\n" + "#define cogl_front_facing gl_FrontFacing\n" \ + "\n" \ + "#define cogl_point_coord gl_PointCoord\n" #if 0 /* GLSL 1.2 has a bottom left origin, though later versions * allow use of an origin_upper_left keyword which would be diff --git a/cogl/cogl-snippet.h b/cogl/cogl-snippet.h index 5eecbfc8..cdce3b26 100644 --- a/cogl/cogl-snippet.h +++ b/cogl/cogl-snippet.h @@ -271,6 +271,19 @@ COGL_BEGIN_DECLS * coloring algorithms. This is equivalent to #gl_FrontFacing. * </para></glossdef> * </glossentry> + * <glossentry> + * <glossterm>vec2 <emphasis>cogl_point_coord</emphasis></glossterm> + * <glossdef><para> + * When rendering points, this will contain a vec2 which represents + * the position within the point of the current fragment. + * vec2(0.0,0.0) will be the topleft of the point and vec2(1.0,1.0) + * will be the bottom right. Note that there is currently a bug in + * Cogl where when rendering to an offscreen buffer these + * coordinates will be upside-down. The value is undefined when not + * rendering points. This builtin can only be used if the + * %COGL_FEATURE_ID_POINT_SPRITE feature is available. + * </para></glossdef> + * </glossentry> * </glosslist> * * Here is an example of using a snippet to add a desaturate effect to the diff --git a/cogl/driver/gl/cogl-pipeline-fragend-glsl.c b/cogl/driver/gl/cogl-pipeline-fragend-glsl.c index 46264a9f..aff42258 100644 --- a/cogl/driver/gl/cogl-pipeline-fragend-glsl.c +++ b/cogl/driver/gl/cogl-pipeline-fragend-glsl.c @@ -408,7 +408,7 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state, if (cogl_pipeline_get_layer_point_sprite_coords_enabled (pipeline, layer->index)) g_string_append_printf (shader_state->source, - "vec4 (gl_PointCoord, 0.0, 1.0)"); + "vec4 (cogl_point_coord, 0.0, 1.0)"); else g_string_append_printf (shader_state->source, "cogl_tex_coord%i_in", |