How do I bring mesh from obj files onto the GPU?
I am trying to do some GPU manipulation of meshes from .obj files. I was testing my code with the stanford bunny obj file, which I imported into a GeometryBasics
Mesh
using
using FileIO
bunny_mesh = load(joinpath((@__DIR__),"stanfordbunny.obj") )
I then try some sort of manipulation on the GPU with Metal.jl
here’s a minimal working example:
using Metal
a = collect(map(pix->let
bunny_mesh=bunny_mesh;
return pix
end,
MtlArray(ones(Float32, 100))))
Doing this returns an array of BrokenBroadcast
instead of
100-element Vector{GPUArrays.BrokenBroadcast{Union{}}}:
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
⋮
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()
GPUArrays.BrokenBroadcast{Union{}}()