Skip to content

Commit

Permalink
fix struct uniforms
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer committed Sep 18, 2023
1 parent d61d05f commit a9126c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion GLMakie/src/GLAbstraction/GLTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,10 @@ function RenderObject(
else
k in (:indices, :visible, :ssao, :label, :cycle) && continue
# structs are treated differently, since they have to be composed into their fields
# NOTE that merge!(data, ...) will break the iteration, so struct uniforms must
# be added after this iteration
if isa_gl_struct(v)
merge!(data, gl_convert_struct(v, k))
merge!(passthrough, gl_convert_struct(v, k))
elseif applicable(gl_convert, v) # if can't be converted to an OpenGL datatype,
try
data[k] = gl_convert(v)
Expand Down
2 changes: 1 addition & 1 deletion GLMakie/src/GLAbstraction/GLUniforms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function isa_gl_struct(x::T) where T
end
function gl_convert_struct(x::T, uniform_name::Symbol) where T
if isa_gl_struct(x)
return Dict{Symbol, Any}(map(fieldnames(x)) do name
return Dict{Symbol, Any}(map(fieldnames(T)) do name
(Symbol("$uniform_name.$name") => gl_convert(getfield(x, name)))
end)
else
Expand Down

0 comments on commit a9126c9

Please sign in to comment.