gKit2 light
Loading...
Searching...
No Matches
quads_display.glsl
Go to the documentation of this file.
1
3
4#version 430
5
6#ifdef VERTEX_SHADER
7
8void main( )
9{
10 vec3 positions[3]= vec3[3]( vec3(-1, 1, -1), vec3( -1, -3, -1), vec3( 3, 1, -1) );
11
12 gl_Position= vec4(positions[gl_VertexID], 1.0);
13}
14#endif
15
16
17#ifdef FRAGMENT_SHADER
18
19layout(binding= 0, r32ui) readonly uniform uimage2D image;
20
21out vec4 fragment_color;
22
23void main( )
24{
25 // utilise une palette de couleur pour afficher la valeur du compteur
26 const vec3 colors[10]= vec3[10](
27 vec3(0,0,0),
28 vec3(12,17,115),
29 vec3(28,121,255),
30 vec3(31,255,255),
31 vec3(130,255,17),
32 vec3(255,255,14),
33 vec3(255,112,22),
34 vec3(251,0,20),
35 vec3(113,1,14),
36 vec3(113,1,14)
37 );
38
39 ivec2 pixel= ivec2(gl_FragCoord.xy);
40 ivec2 quad= pixel / 2;
41
42 //~ uint n= imageLoad(image, ivec2(gl_FragCoord.xy)).r;
43 uint n= imageLoad( image, quad ).r;
44 vec3 color;
45 if(n < 10) color= colors[n] / vec3(255);
46 else color= colors[9] / vec3(255);
47
48 fragment_color= vec4(color, 1.0);
49}
50#endif
vecteur generique, utilitaire.
Definition vec.h:169
vecteur generique 4d, ou 3d homogene, utilitaire.
Definition vec.h:192