JuliaGL / GLVisualize.jl

Visualization library written in Julia and OpenGL
Other
247 stars 34 forks source link

2D plot throws error program not linked #238

Closed SebastianM-C closed 6 years ago

SebastianM-C commented 6 years ago

Hello! I tried to plot some random 2D points with the following code in REPL

using Plots
glvisualize()
plot(rand(10),rand(10))

and I got the following error:

1   : #version 330
2   : 
3   : #extension GL_ARB_conservative_depth: enable
4   : 
5   : in vec2 vertex;
6   : uniform vec4 color;
7   : uniform double thickness;
8   : 
9   : uniform mat4 projection, view, model;
10  : uniform uint objectid;
11  : 
12  : out uvec2 g_id;
13  : out vec4 g_color;
14  : out float g_thickness;
15  : 
16  : vec4 getindex(sampler2D tex, int index);
17  : vec4 getindex(sampler1D tex, int index);
18  : 
19  : vec4 to_vec4(vec3 v){return vec4(v, 1);}
20  : vec4 to_vec4(vec2 v){return vec4(v, 0, 1);}
21  : 
22  : 
23  : void main()
24  : {
25  :     int index   = gl_VertexID;
26  :     g_id        = uvec2(objectid, index+1);
27  :     g_color     = color;;
28  :     g_thickness = thickness;
29  :     gl_Position = projection*view*model*to_vec4(vertex);
30  : }
31  : 
WARNING: shader /home/user/.julia/v0.6/GLVisualize/src/../assets/shader/line_segment.vert didn't compile. 
0(7) : error C7532: global type double requires "#version 400" or later
0(7) : error C0000: ... or #extension GL_ARB_gpu_shader_fp64 : enable
1   : #version 330
2   : 
3   : #extension GL_ARB_conservative_depth: enable
4   : 
5   : in vec2 vertex;
6   : uniform vec4 color;
7   : uniform double thickness;
8   : 
9   : uniform mat4 projection, view, model;
10  : uniform uint objectid;
11  : 
12  : out uvec2 g_id;
13  : out vec4 g_color;
14  : out float g_thickness;
15  : 
16  : vec4 getindex(sampler2D tex, int index);
17  : vec4 getindex(sampler1D tex, int index);
18  : 
19  : vec4 to_vec4(vec3 v){return vec4(v, 1);}
20  : vec4 to_vec4(vec2 v){return vec4(v, 0, 1);}
21  : 
22  : 
23  : void main()
24  : {
25  :     int index   = gl_VertexID;
26  :     g_id        = uvec2(objectid, index+1);
27  :     g_color     = color;;
28  :     g_thickness = thickness;
29  :     gl_Position = projection*view*model*to_vec4(vertex);
30  : }
31  : 
WARNING: shader /home/user/.julia/v0.6/GLVisualize/src/../assets/shader/line_segment.vert didn't compile. 
0(7) : error C7532: global type double requires "#version 400" or later
0(7) : error C0000: ... or #extension GL_ARB_gpu_shader_fp64 : enable
Error showing value of type Plots.Plot{Plots.GLVisualizeBackend}:
ERROR: program 22 not linked. Error in: 
/home/user/.julia/v0.6/GLVisualize/src/../assets/shader/fragment_output.frag or /home/user/.julia/v0.6/GLVisualize/src/../assets/shader/util.vert or /home/user/.julia/v0.6/GLVisualize/src/../assets/shader/line_segment.vert or /home/user/.julia/v0.6/GLVisualize/src/../assets/shader/line_segment.geom or /home/user/.julia/v0.6/GLVisualize/src/../assets/shader/lines.frag
Vertex info
-----------
0(7) : error C7532: global type double requires "#version 400" or later
0(7) : error C0000: ... or #extension GL_ARB_gpu_shader_fp64 : enable
(0) : error C2003: incompatible options for link

If I try to plot in 3D, it works (with plot3d(rand(10),rand(10),rand(10))). Am I missing something? My OpenGL info is:

user@ArchLinux:~ $ glxinfo | grep OpenGL          
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 960M/PCIe/SSE2
OpenGL core profile version string: 4.5.0 NVIDIA 387.34
OpenGL core profile shading language version string: 4.50 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 387.34
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 387.34
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

and I am on the master branch of GLVisualize

julia> Pkg.status("GLVisualize")
 - GLVisualize                   0.6.1+             master
SimonDanisch commented 6 years ago

I can see how that's happening, since I forgot a convert in the line code - but this was working fine previously and seems to be a regression in Plots.jl. Not sure why that popped up suddenly! I opened a PR to fix it!

SebastianM-C commented 6 years ago

Thanks!