Gnimuc / CImGui.jl

Julia wrapper for cimgui
https://github.com/cimgui/cimgui
MIT License
253 stars 25 forks source link

error running makie_demo.jl #135

Closed FaresX closed 1 month ago

FaresX commented 1 month ago
: #version 150
2   : 
3   : 
4   : in vec2 frag_uv;
5   : 
6   : uniform sampler2D color_texture;
7   : uniform usampler2D object_ids;
8   : 
9   : layout(location=0) out vec4 fragment_color;
10  : 
11  : vec3 linear_tone_mapping(vec3 color, float gamma)
12  : {
13  :     color = clamp(color, 0.0, 1.0);
14  :     color = pow(color, vec3(1. / gamma));
15  :     return color;
16  : }
17  :
18  : bool unpack_bool(uint id) {
19  :     uint high_bit_mask = uint(1) << uint(31);
20  :     return id >= high_bit_mask;
21  : }
22  :
23  : void main(void)
24  : {
25  :     vec4 color = texture(color_texture, frag_uv).rgba;
26  :     if(color.a <= 0){
27  :         discard;
28  :     }
29  :
30  :     uint id = texture(object_ids, frag_uv).x;
31  :     // do tonemappings
32  :     //opaque = linear_tone_mapping(color.rgb, 1.8);  // linear color output
33  :     fragment_color.rgb = color.rgb;
34  :     // we store fxaa = true/false in highbit of the object id
35  :     if (unpack_bool(id)) {
36  :         fragment_color.a = dot(color.rgb, vec3(0.299, 0.587, 0.114)); // compute luma
37  :     } else {
38  :         // we disable fxaa by setting luma to 1
39  :         fragment_color.a = 1.0;
40  :     }
41  : }
42  :
┌ Warning: shader C:\Users\22112\.julia\packages\GLMakie\z5T26\assets\shader\postprocessing/postprocess.frag didn't compile.
│ ERROR: 0:9: 'location' : syntax error syntax error
│ 
└ @ GLMakie.GLAbstraction C:\Users\22112\.julia\packages\GLMakie\z5T26\src\GLAbstraction\GLShader.jl:128
1   : #version 150
2   :
3   :
4   : in vec2 frag_uv;
5   :
6   : uniform sampler2D color_texture;
7   : uniform usampler2D object_ids;
8   :
9   : layout(location=0) out vec4 fragment_color;
10  :
11  : vec3 linear_tone_mapping(vec3 color, float gamma)
12  : {
13  :     color = clamp(color, 0.0, 1.0);
14  :     color = pow(color, vec3(1. / gamma));
15  :     return color;
16  : }
17  :
18  : bool unpack_bool(uint id) {
19  :     uint high_bit_mask = uint(1) << uint(31);
20  :     return id >= high_bit_mask;
21  : }
22  :
23  : void main(void)
24  : {
25  :     vec4 color = texture(color_texture, frag_uv).rgba;
26  :     if(color.a <= 0){
27  :         discard;
28  :     }
29  :
30  :     uint id = texture(object_ids, frag_uv).x;
31  :     // do tonemappings
32  :     //opaque = linear_tone_mapping(color.rgb, 1.8);  // linear color output
33  :     fragment_color.rgb = color.rgb;
34  :     // we store fxaa = true/false in highbit of the object id
35  :     if (unpack_bool(id)) {
36  :         fragment_color.a = dot(color.rgb, vec3(0.299, 0.587, 0.114)); // compute luma
37  :     } else {
38  :         // we disable fxaa by setting luma to 1
39  :         fragment_color.a = 1.0;
40  :     }
41  : }
42  :
┌ Warning: shader C:\Users\22112\.julia\packages\GLMakie\z5T26\assets\shader\postprocessing/postprocess.frag didn't compile. 
│ ERROR: 0:9: 'location' : syntax error syntax error
│ 
└ @ GLMakie.GLAbstraction C:\Users\22112\.julia\packages\GLMakie\z5T26\src\GLAbstraction\GLShader.jl:128
┌ Error: Error in CImGui GlfwOpenGL3 renderloop!
│   exception =
│    program 12 not linked. Error in:
│    C:\Users\22112\.julia\packages\GLMakie\z5T26\assets\shader\postprocessing/fullscreen.vert or C:\Users\22112\.julia\packages\GLMakie\z5T26\assets\shader\postprocessing/postprocess.frag
│    Attached fragment shader is not compiled.
│ 
│    Stacktrace:
│      [1] error(::String, ::String, ::String, ::String)
│        @ Base .\error.jl:44
│      [2] compile_program(shaders::Vector{GLMakie.GLAbstraction.Shader}, fragdatalocation::Vector{Tuple{Int64, String}})
│        @ GLMakie.GLAbstraction C:\Users\22112\.julia\packages\GLMakie\z5T26\src\GLAbstraction\GLShader.jl:172
│      [3] (::GLMakie.GLAbstraction.var"#53#54"{GLMakie.GLAbstraction.ShaderCache, Vector{Vector{String}}, Vector{Vector{String}}, Vector{Tuple{Int64, String}}, Vector{GLMakie.ShaderSource}})()
│        @ GLMakie.GLAbstraction C:\Users\22112\.julia\packages\GLMakie\z5T26\src\GLAbstraction\GLShader.jl:223
│      [4] get!(default::GLMakie.GLAbstraction.var"#53#54"{GLMakie.GLAbstraction.ShaderCache, Vector{Vector{String}}, Vector{Vector{String}}, Vector{Tuple{Int64, String}}, Vector{GLMakie.ShaderSource}}, h::Dict{Any, GLMakie.GLAbstraction.GLProgram}, key::Tuple{Vector{GLMakie.ShaderSource}, Vector{Vector{String}}})
│        @ Base .\dict.jl:479
│      [5] gl_convert(cache::GLMakie.GLAbstraction.ShaderCache, lazyshader::GLMakie.GLAbstraction.LazyShader, data::Dict{Symbol, Any})
│        @ GLMakie.GLAbstraction C:\Users\22112\.julia\packages\GLMakie\z5T26\src\GLAbstraction\GLShader.jl:214
│      [6] gl_convert
│        @ C:\Users\22112\.julia\packages\GLMakie\z5T26\src\GLAbstraction\GLShader.jl:195 [inlined]
│      [7] GLMakie.GLAbstraction.RenderObject(data::Dict{Symbol, Any}, program::GLMakie.GLAbstraction.LazyShader, pre::GLMakie.PostprocessPrerender, post::Nothing, context::MakieIntegration.ImMakieWindow)
│        @ GLMakie.GLAbstraction C:\Users\22112\.julia\packages\GLMakie\z5T26\src\GLAbstraction\GLTypes.jl:401
│      [8] GLMakie.GLAbstraction.RenderObject(data::Dict{Symbol, Any}, program::GLMakie.GLAbstraction.LazyShader, pre::GLMakie.PostprocessPrerender, post::Nothing)
│        @ GLMakie.GLAbstraction C:\Users\22112\.julia\packages\GLMakie\z5T26\src\GLAbstraction\GLTypes.jl:346
│      [9] fxaa_postprocessor(framebuffer::GLMakie.GLFramebuffer, shader_cache::GLMakie.GLAbstraction.ShaderCache)
│        @ GLMakie C:\Users\22112\.julia\packages\GLMakie\z5T26\src\postprocessing.jl:229
│     [10] (::MakieIntegration.var"#replace_processor!#1"{GLMakie.Screen{MakieIntegration.ImMakieWindow}})(postprocessor::typeof(GLMakie.fxaa_postprocessor), idx::Int64)
│        @ MakieIntegration C:\Users\22112\.julia\packages\CImGui\jnzFA\ext\MakieIntegration.jl:63
│     [11] apply_config!(screen::GLMakie.Screen{MakieIntegration.ImMakieWindow}, config::GLMakie.ScreenConfig)
│        @ MakieIntegration C:\Users\22112\.julia\packages\CImGui\jnzFA\ext\MakieIntegration.jl:71
│     [12] MakieFigure(title_id::String, f::Figure; auto_resize_x::Bool, auto_resize_y::Bool, tooltip::Bool)
│        @ MakieIntegration C:\Users\22112\.julia\packages\CImGui\jnzFA\ext\MakieIntegration.jl:135
│     [13] (::var"#19#20"{Axis, Observable{Vector{Point{2, Float32}}}, Axis, Scene, Figure})()
│        @ Main c:\Users\22112\.julia\packages\CImGui\jnzFA\examples\makie_demo.jl:67
│     [14] #invokelatest#2
│        @ .\essentials.jl:892 [inlined]
│     [15] invokelatest
│        @ .\essentials.jl:889 [inlined]
│     [16] _render(ui::var"#19#20"{Axis, Observable{Vector{Point{2, Float32}}}, Axis, Scene, Figure}, ctx::Ptr{CImGui.lib.ImGuiContext}, ::Val{:GlfwOpenGL3}; hotloading::Bool, on_exit::Nothing, clear_color::Vector{Float32}, window_size::Tuple{Int64, Int64}, window_title::String, engine::Nothing, opengl_version::VersionNumber)
│        @ GlfwOpenGLBackend C:\Users\22112\.julia\packages\CImGui\jnzFA\ext\GlfwOpenGLBackend.jl:107
│     [17] render(::Function, ::Vararg{Any}; kwargs::@Kwargs{engine::Nothing, window_size::Tuple{Int64, Int64}, window_title::String})
│        @ CImGui C:\Users\22112\.julia\packages\CImGui\jnzFA\src\CImGui.jl:183
│     [18] render
│        @ C:\Users\22112\.julia\packages\CImGui\jnzFA\src\CImGui.jl:181 [inlined]
│     [19] makie_demo(; engine::Nothing)
│        @ Main c:\Users\22112\.julia\packages\CImGui\jnzFA\examples\makie_demo.jl:49
│     [20] makie_demo()
│        @ Main c:\Users\22112\.julia\packages\CImGui\jnzFA\examples\makie_demo.jl:28
│     [21] top-level scope
│        @ c:\Users\22112\.julia\packages\CImGui\jnzFA\examples\makie_demo.jl:85
│     [22] eval
│        @ .\boot.jl:385 [inlined]
│     [23] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
│        @ Base .\loading.jl:2076
│     [24] include_string(m::Module, txt::String, fname::String)
│        @ Base .\loading.jl:2086
│     [25] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{})
│        @ Base .\essentials.jl:892
│     [26] invokelatest(::Any, ::Any, ::Vararg{Any})
│        @ Base .\essentials.jl:889
│     [27] inlineeval(m::Module, code::String, code_line::Int64, code_column::Int64, file::String; softscope::Bool)
│        @ VSCodeServer c:\Users\22112\.vscode\extensions\julialang.language-julia-1.105.2\scripts\packages\VSCodeServer\src\eval.jl:271
│     [28] (::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
│        @ VSCodeServer c:\Users\22112\.vscode\extensions\julialang.language-julia-1.105.2\scripts\packages\VSCodeServer\src\eval.jl:181
│     [29] withpath(f::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
│        @ VSCodeServer c:\Users\22112\.vscode\extensions\julialang.language-julia-1.105.2\scripts\packages\VSCodeServer\src\repl.jl:276
│     [30] (::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
│        @ VSCodeServer c:\Users\22112\.vscode\extensions\julialang.language-julia-1.105.2\scripts\packages\VSCodeServer\src\eval.jl:179
│     [31] hideprompt(f::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})     
│        @ VSCodeServer c:\Users\22112\.vscode\extensions\julialang.language-julia-1.105.2\scripts\packages\VSCodeServer\src\repl.jl:38
│     [32] (::VSCodeServer.var"#67#72"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
│        @ VSCodeServer c:\Users\22112\.vscode\extensions\julialang.language-julia-1.105.2\scripts\packages\VSCodeServer\src\eval.jl:150
│     [33] with_logstate(f::Function, logstate::Any)
│        @ Base.CoreLogging .\logging.jl:515
│     [34] with_logger
│        @ .\logging.jl:627 [inlined]
│     [35] (::VSCodeServer.var"#66#71"{VSCodeServer.ReplRunCodeRequestParams})()
│        @ VSCodeServer c:\Users\22112\.vscode\extensions\julialang.language-julia-1.105.2\scripts\packages\VSCodeServer\src\eval.jl:263
│     [36] #invokelatest#2
│        @ .\essentials.jl:892 [inlined]
│     [37] invokelatest(::Any)
│        @ Base .\essentials.jl:889
│     [38] (::VSCodeServer.var"#64#65")()
│        @ VSCodeServer c:\Users\22112\.vscode\extensions\julialang.language-julia-1.105.2\scripts\packages\VSCodeServer\src\eval.jl:34
└ @ GlfwOpenGLBackend C:\Users\22112\.julia\packages\CImGui\jnzFA\ext\GlfwOpenGLBackend.jl:145
JamesWrigley commented 1 month ago

Does GLMakie by itself run on your machine? And what if you try passing opengl_version=v"3.3" to ig.render()?

FaresX commented 1 month ago

version 3.3 works well