Skip to content

Instantly share code, notes, and snippets.

@ssfrr
Created February 29, 2016 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssfrr/f129b321317aa5a735b2 to your computer and use it in GitHub Desktop.
Save ssfrr/f129b321317aa5a735b2 to your computer and use it in GitHub Desktop.
GLVisualize Error
1 : #version 330
2 :
3 : #extension GL_ARB_conservative_depth: enable
4 :
5 : #define CIRCLE 0
6 : #define RECTANGLE 1
7 : #define ROUNDED_RECTANGLE 2
8 : #define DISTANCEFIELD 3
9 :
10 : in vec4 f_color;
11 : in vec2 f_uv;
12 : flat in uvec2 f_id;
13 : uniform int shape;
14 : uniform bool dotted;
15 :
16 : const float ALIASING_CONST = 0.7710678118654757;
17 :
18 : float aastep(float threshold1, float value) {
19 : float afwidth = length(vec2(dFdx(value), dFdy(value))) * ALIASING_CONST;
20 : return smoothstep(threshold1-afwidth, threshold1+afwidth, value);
21 : }
22 : float aastep(float threshold1, float threshold2, float value) {
23 : float afwidth = length(vec2(dFdx(value), dFdy(value))) * ALIASING_CONST;
24 : return smoothstep(threshold1-afwidth, threshold1+afwidth, value)-smoothstep(threshold2-afwidth, threshold2+afwidth, value);
25 : }
26 : float rectangle(vec2 uv)
27 : {
28 : vec2 d = max(-uv, uv-vec2(1));
29 : return -((length(max(vec2(0.0), d)) + min(0.0, max(d.x, d.y))));
30 : }
31 : float circle(vec2 uv){
32 : return (1-length(uv-0.5))-0.5;
33 : }
34 : float rounded_rectangle(vec2 uv, vec2 tl, vec2 br)
35 : {
36 : vec2 d = max(tl-uv, uv-br);
37 : return -((length(max(vec2(0.0), d)) + min(0.0, max(d.x, d.y)))-tl.x);
38 : }
39 :
40 : layout (depth_greater) out float gl_FragDepth;
41 : out vec4 fragment_color;
42 : out uvec2 fragment_groupid;
43 : void write2framebuffer(vec4 color, uvec2 id){
44 : fragment_color = color;
45 : fragment_groupid = id;
46 : if (color.a > 0.5){
47 : gl_FragDepth = gl_FragCoord.z;
48 : }else{
49 : gl_FragDepth = 1.0;
50 : }
51 : }
52 :
53 : void main(){
54 : vec4 color;
55 : if(dotted){
56 : vec2 uv = vec2(fract(f_uv.x), f_uv.y);
57 : float signed_distance;
58 : if(shape == CIRCLE)
59 : signed_distance = circle(uv);
60 : else if(shape == ROUNDED_RECTANGLE)
61 : signed_distance = rounded_rectangle(uv, vec2(0.2), vec2(0.8));
62 : else if(shape == RECTANGLE)
63 : signed_distance = rectangle(uv);
64 : float inside = aastep(0.0, 120.0, signed_distance);
65 : color = vec4(f_color.rgb, f_color.a*inside);
66 : }else{
67 : color = vec4(f_color.rgb, f_color.a*aastep(0.2, 0.8, f_uv.y));
68 : }
69 : write2framebuffer(color, f_id);
70 : }
71 :
WARNING: shader /Users/srussell/.julia/v0.4/GLVisualize/src/../assets/shader/lines.frag didn't compile.
WARNING: 0:3: extension 'GL_ARB_conservative_depth' is not supported
ERROR: 0:40: Unknown identifier 'depth_greater' in layout
WARNING: program 19 not linked. Error in:
/Users/srussell/.julia/v0.4/GLVisualize/src/../assets/shader/util.vert or
/Users/srussell/.julia/v0.4/GLVisualize/src/../assets/shader/line_segment.vert or
/Users/srussell/.julia/v0.4/GLVisualize/src/../assets/shader/line_segment.geom or
/Users/srussell/.julia/v0.4/GLVisualize/src/../assets/shader/lines.frag
ERROR: One or more attached shaders not successfully compiled
ERROR: LoadError: Named attribute (:vertex) is not an active attribute in the specified program object or
the name starts with the reserved prefix gl_
in get_attribute_location at /Users/srussell/.julia/v0.4/GLAbstraction/src/GLExtendedFunctions.jl:30
in call at /Users/srussell/.julia/v0.4/GLAbstraction/src/GLTypes.jl:166
in call at /Users/srussell/.julia/v0.4/GLAbstraction/src/GLTypes.jl:246
in assemble_shader at /Users/srussell/.julia/v0.4/GLVisualize/src/utils.jl:28
in view_boundingboxes at /Users/srussell/.julia/v0.4/GLVisualize/test/runtests.jl:22
in include at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib
in include_from_node1 at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib
in process_options at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib
in _start at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib
while loading /Users/srussell/.julia/v0.4/GLVisualize/test/runtests.jl, in expression starting on line 80
=============================[ ERROR: GLVisualize ]=============================
failed process: Process(`/Applications/Julia-0.4.3.app/Contents/Resources/julia/bin/julia --check-bounds=yes --code-coverage=none --color=yes /Users/srussell/.julia/v0.4/GLVisualize/test/runtests.jl`, ProcessExited(1)) [1]
================================================================================
INFO: Removing ImageMagick v0.1.3
INFO: Removing QuartzImageIO v0.1.1
ERROR: GLVisualize had test errors
in error at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib
in test at pkg/entry.jl:803
in anonymous at pkg/dir.jl:31
in cd at file.jl:22
in cd at pkg/dir.jl:31
in test at pkg.jl:71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment