summaryrefslogtreecommitdiff
path: root/clutter-gst/clutter-gst-shaders.h
blob: a570956bb94c56ee47d835d3c64be5af3e0f7d75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

#ifndef CLUTTER_GST_SHADERS_H
#define CLUTTER_GST_SHADERS_H

#include <clutter/clutter.h>

/* Copied from test-shaders */

/* These variables are used instead of the standard GLSL variables on
   GLES 2 */
#ifdef HAVE_COGL_GLES2

#define GLES2_VARS              \
  "precision mediump float;\n"  \
  "varying vec2 tex_coord;\n"   \
  "varying vec4 frag_color;\n"
#define TEX_COORD "tex_coord"
#define COLOR_VAR "frag_color"

#else /* HAVE_COGL_GLES2 */

#define GLES2_VARS ""
#define TEX_COORD "gl_TexCoord[0]"
#define COLOR_VAR "gl_Color"

#endif /* HAVE_COGL_GLES2 */

/* a couple of boilerplate defines that are common amongst all the
 * sample shaders
 */

#define FRAGMENT_SHADER_VARS      \
  GLES2_VARS

/* FRAGMENT_SHADER_END: apply the changed color to the output buffer correctly
 * blended with the gl specified color (makes the opacity of actors work
 * correctly).
 */
#define FRAGMENT_SHADER_END                             \
     "  gl_FragColor = gl_FragColor * " COLOR_VAR ";"

#endif