Graphite Version 3
An experimental 3D geometry processing program
Loading...
Searching...
No Matches
defs.h
1#ifdef GL_ES
2#if __VERSION__ == 100
3#define GLUP_ES_100
4#endif
5#endif
6
7
8#ifdef GLUP_ES_100
9int glup_mod(in int x, in int y) {
10 return x - (x/y)*y;
11}
12#else
13int glup_mod(in int x, in int y) {
14 return x % y;
15}
16#endif
17
18
19// Definitions for GLUPES shaders
20// These macro are used to have portable
21// declarations with
22// OpenGLES 2.0, GLSL 1.3 and GLSL 1.5,
23
24#ifdef GLUP_ES_100
25#ifdef GLUP_VERTEX_SHADER
26#define glup_in attribute
27#define glup_out varying
28#elif defined GLUP_FRAGMENT_SHADER
29#define glup_in varying
30#endif
31#define glup_flat
32#define glup_id highp float
33#else
34#define glup_in in
35#define glup_out out
36#define glup_flat flat
37#define glup_id highp int
38#endif
39
40#ifdef GLUP_ES_100
41vec4 glup_texture(in sampler2D samp, in vec2 uv) {
42 return texture2D(samp, uv);
43}
44#else
45vec4 glup_texture(in sampler2D samp, in vec2 uv) {
46 return texture(samp, uv);
47}
48#endif
49
50#ifdef GLUP_FRAGMENT_SHADER
51#ifdef GLUP_ES_100
52#define glup_FragColor gl_FragColor
53#ifdef GL_EXT_frag_depth
54#define glup_FragDepth gl_FragDepthEXT
55#else
56float glup_FragDepth; // depth updates will be ignored
57#endif
58#else
59out vec4 glup_FragColor;
60#define glup_FragDepth gl_FragDepth
61#endif
62#endif
vecng< 4, Numeric::float64 > vec4
Represents points and vectors in 4d.
Definition geometry.h:71