Add the cogl_point_coord snippet builtin
This adds a #define for gl_PointCoord to all shaders so that it can be accessed with a name in the Cogl namespace. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit c28fc054788e88627bcc2346f4c4c368870ff777)
This commit is contained in:
parent
cb178b7a3a
commit
4bc7377727
@ -66,7 +66,9 @@
|
|||||||
"#define cogl_color_out gl_FragColor\n" \
|
"#define cogl_color_out gl_FragColor\n" \
|
||||||
"#define cogl_depth_out gl_FragDepth\n" \
|
"#define cogl_depth_out gl_FragDepth\n" \
|
||||||
"\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
|
#if 0
|
||||||
/* GLSL 1.2 has a bottom left origin, though later versions
|
/* GLSL 1.2 has a bottom left origin, though later versions
|
||||||
* allow use of an origin_upper_left keyword which would be
|
* allow use of an origin_upper_left keyword which would be
|
||||||
|
@ -279,6 +279,19 @@ COGL_BEGIN_DECLS
|
|||||||
* coloring algorithms. This is equivalent to #gl_FrontFacing.
|
* coloring algorithms. This is equivalent to #gl_FrontFacing.
|
||||||
* </para></glossdef>
|
* </para></glossdef>
|
||||||
* </glossentry>
|
* </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>
|
* </glosslist>
|
||||||
*
|
*
|
||||||
* Here is an example of using a snippet to add a desaturate effect to the
|
* Here is an example of using a snippet to add a desaturate effect to the
|
||||||
|
@ -421,7 +421,7 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
|
|||||||
if (cogl_pipeline_get_layer_point_sprite_coords_enabled (pipeline,
|
if (cogl_pipeline_get_layer_point_sprite_coords_enabled (pipeline,
|
||||||
layer->index))
|
layer->index))
|
||||||
g_string_append_printf (shader_state->source,
|
g_string_append_printf (shader_state->source,
|
||||||
"vec4 (gl_PointCoord, 0.0, 1.0)");
|
"vec4 (cogl_point_coord, 0.0, 1.0)");
|
||||||
else
|
else
|
||||||
g_string_append_printf (shader_state->source,
|
g_string_append_printf (shader_state->source,
|
||||||
"cogl_tex_coord%i_in",
|
"cogl_tex_coord%i_in",
|
||||||
|
Loading…
Reference in New Issue
Block a user