# Problems with GLMakie

**URL:** https://discourse.julialang.org/t/problems-with-glmakie/133922
**Category:** General Usage
**Tags:** package, makie
**Created:** [November 17, 2025, 4:48am UTC](https://discourse.julialang.org/t/problems-with-glmakie/133922 "2025-11-17T04:48:51Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Mervyn\_Larrier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mervyn_larrier/32/37709_2.png) [@Mervyn\_Larrier](https://discourse.julialang.org/u/Mervyn_Larrier)
#### Post date: [November 17, 2025, 4:48am UTC](https://discourse.julialang.org/t/problems-with-glmakie/133922/1 "2025-11-17T04:48:51Z")

</div>

I’m trying to learn how to use GLMakie having had a lot of success with CairoMakie. But I immediately ran into issues. VSCode is my main text editor, and whereas I’ve never had an issue with CairoMakie, I can’t say the same here. This example comes from the mesh section on the Beautiful Makie website, but I cannot run it. From the closeall() function to the basic geometry types, I keep getting that the functions are undefined. Any help would be greatly appreciated.

```julia-auto
using GLMakie, Random, Colors, LinearAlgebra
using GeometryBasics: Cylinder, Pyramid
using Makie
import GeometryBasics
GLMakie.closeall() # close any open screen

Random.seed!(3)

cyl = Cylinder(Point{3, Float64}(1,2,3), Point{3, Float64}(2,3,4), 1.0)
pyr = Pyramid(Point3f(0), 1f0, 1f0)
rectmesh = Rect3(Point3f(-0.5), Vec3f(1))
rectthin = Rect3(Point3f(-1), Vec3f(2,2,0.25))
sphere = Sphere(Point3f(-0.5), 1)
Cone(; quality = 10) = merge([
    Makie._circle(Point3f(0), 0.5f0, Vec3f(0,0,-1), quality),
    Makie._mantle(Point3f(0), Point3f(0,0,1), 0.5f0, 0f0, quality)])
cone = Cone()
rectMesh = GeometryBasics.mesh(rectmesh)
rectThin = GeometryBasics.mesh(rectthin)
cyL = GeometryBasics.mesh(cyl)

cmap = resample_cmap(:Spectral_11, 3*length(rectMesh.position))
colors1 = [cmap[i] for i in 1:3*length(rectMesh.position)]
colors2 = repeat([RGBA(rand(4)...) for v in rectThin.position], 3)
colors3 = repeat([norm(v) for v in cyL.position], 2)[1:62]
markers = [sphere, rectmesh, cyl, pyr, cone]

with_theme(theme_dark()) do
    fig = Figure(size = (1200,800))
    axs = [Axis3(fig[i,j]; aspect = :data, perspectiveness = 0.5)
        for j in 1:3, i in 1:2]
    mesh!(axs[1], sphere, color = :white)
    mesh!(axs[2], rectmesh, color = colors1)
    mesh!(axs[3], pyr; color = (:dodgerblue, 0.85))
    wireframe!(axs[3], pyr; color = :grey90)
    mesh!(axs[4], cyl; color = colors3,
        colormap = :diverging_tritanopic_cwr_75_98_c20_n256)
    mesh!(axs[5], cone; transparency = true)
    wireframe!(axs[5], cone; color = :grey90, linewidth = 0.5)
    mesh!(axs[6], rectthin; color = colors2, shading = NoShading)
    [meshscatter!(axs[6], Point3f(1.5rand(3) .- 0.5); marker = markers[i],
        markersize = 0.25) for i in 1:5]
    fig
end

```

---

<div class="post-metadata">

### Author: ![technocrat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/technocrat/32/220947_2.png) [@technocrat](https://discourse.julialang.org/u/technocrat)
#### Post date: [November 17, 2025, 5:48am UTC](https://discourse.julialang.org/t/problems-with-glmakie/133922/2 "2025-11-17T05:48:09Z")

</div>

`Makie._circle` and `Makie._mantle` are the culprits. I’m not sure what, if anything, was supposed to replace them. The figure can be reproduced with:

```julia-auto
using GeometryBasics
using LinearAlgebra

function Cone(; quality = 10)
    # Create base circle points
    base_radius = 0.5f0
    base_points = Point3f[]
    for i in 0:quality-1
        angle = 2π * i / quality
        x = base_radius * cos(angle)
        y = base_radius * sin(angle)
        push!(base_points, Point3f(x, y, 0))
    end
    
    # Apex point
    apex = Point3f(0, 0, 1)
    
    # Create faces connecting base to apex
    faces = TriangleFace{Int}[]
    for i in 1:quality
        next_i = (i % quality) + 1
        # Triangle: base point i, base point next, apex
        push!(faces, TriangleFace(i, next_i, quality + 1))
    end
    
    # Base circle face
    base_face_indices = collect(1:quality)
    for i in 2:quality-1
        push!(faces, TriangleFace(1, i, i + 1))
    end
    
    # Combine all points
    all_points = vcat(base_points, [apex])
    
    return GeometryBasics.Mesh(all_points, faces)
end

```

 ![CleanShot 2025-11-16 at 21.47.14@2x](https://global.discourse-cdn.com/julialang/original/3X/d/2/d24a056eac90ad90f16932394fa6126e4bc2a51a.jpeg)

---

<div class="post-metadata">

### Author: ![Mervyn\_Larrier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mervyn_larrier/32/37709_2.png) [@Mervyn\_Larrier](https://discourse.julialang.org/u/Mervyn_Larrier)
#### Post date: [November 17, 2025, 11:50pm UTC](https://discourse.julialang.org/t/problems-with-glmakie/133922/3 "2025-11-17T23:50:35Z")

</div>

That tidy bit of code goes to replace the Cone function, right? I run into issues before this juncture. I should point out that when I defined the function in its own script and ran it, it seemed to compile fine. No errors were thrown and the function appeared defined with one function. Here’s what I’m seeing on my end:

 ![image_2025-11-17_185020758](https://global.discourse-cdn.com/julialang/original/3X/8/d/8dd9103993001fa0bd6ac58d34b219484a6d9912.png)

---

<div class="post-metadata">

### Author: ![technocrat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/technocrat/32/220947_2.png) [@technocrat](https://discourse.julialang.org/u/technocrat)
#### Post date: [November 18, 2025, 12:56am UTC](https://discourse.julialang.org/t/problems-with-glmakie/133922/4 "2025-11-18T00:56:46Z")

</div>

Yeah, it was supposed to be a drop-in. In re-running this, I ran into a namespace conflict with Cone, so I’ve changed it to Kone. I also had to import TriangleFact this time. Here’s the whole script:

```julia-auto
using GLMakie, Random, Colors, LinearAlgebra
using GeometryBasics: Cylinder, Pyramid, TriangleFace
using Makie
import GeometryBasics
GLMakie.closeall() # close any open screen

Random.seed!(3)

cyl = Cylinder(Point{3, Float64}(1,2,3), Point{3, Float64}(2,3,4), 1.0)
pyr = Pyramid(Point3f(0), 1f0, 1f0)
rectmesh = Rect3(Point3f(-0.5), Vec3f(1))
rectthin = Rect3(Point3f(-1), Vec3f(2,2,0.25))
sphere = Sphere(Point3f(-0.5), 1)
function Kone(; quality = 10)
    # Create base circle points
    base_radius = 0.5f0
    base_points = Point3f[]
    for i in 0:quality-1
        angle = 2π * i / quality
        x = base_radius * cos(angle)
        y = base_radius * sin(angle)
        push!(base_points, Point3f(x, y, 0))
    end
    
    # Apex point
    apex = Point3f(0, 0, 1)
    
    # Create faces connecting base to apex
    faces = TriangleFace{Int}[]
    for i in 1:quality
        next_i = (i % quality) + 1
        # Triangle: base point i, base point next, apex
        push!(faces, TriangleFace(i, next_i, quality + 1))
    end
    
    # Base circle face
    base_face_indices = collect(1:quality)
    for i in 2:quality-1
        push!(faces, TriangleFace(1, i, i + 1))
    end
    
    # Combine all points
    all_points = vcat(base_points, [apex])
    
    return GeometryBasics.Mesh(all_points, faces)
end

cone = Kone()
rectMesh = GeometryBasics.mesh(rectmesh)
rectThin = GeometryBasics.mesh(rectthin)
cyL = GeometryBasics.mesh(cyl)

cmap = resample_cmap(:Spectral_11, 3*length(rectMesh.position))
colors1 = [cmap[i] for i in 1:3*length(rectMesh.position)]
colors2 = repeat([RGBA(rand(4)...) for v in rectThin.position], 3)
colors3 = repeat([norm(v) for v in cyL.position], 2)[1:62]
markers = [sphere, rectmesh, cyl, pyr, cone]

with_theme(theme_dark()) do
    fig = Figure(size = (1200,800))
    axs = [Axis3(fig[i,j]; aspect = :data, perspectiveness = 0.5)
        for j in 1:3, i in 1:2]
    mesh!(axs[1], sphere, color = :white)
    mesh!(axs[2], rectmesh, color = colors1)
    mesh!(axs[3], pyr; color = (:dodgerblue, 0.85))
    wireframe!(axs[3], pyr; color = :grey90)
    mesh!(axs[4], cyl; color = colors3,
        colormap = :diverging_tritanopic_cwr_75_98_c20_n256)
    mesh!(axs[5], cone; transparency = true)
    wireframe!(axs[5], cone; color = :grey90, linewidth = 0.5)
    mesh!(axs[6], rectthin; color = colors2, shading = NoShading)
    [meshscatter!(axs[6], Point3f(1.5rand(3) .- 0.5); marker = markers[i],
        markersize = 0.25) for i in 1:5]
    fig
end

```

---

<div class="post-metadata">

### Author: ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)
#### Post date: [November 18, 2025, 1:22am UTC](https://discourse.julialang.org/t/problems-with-glmakie/133922/5 "2025-11-18T01:22:09Z")

</div>

In GeometryBasics.jl v0.5 (the newest version) there is a native `Cone` type:

> <https://github.com/JuliaGeometry/GeometryBasics.jl/blob/86fc11c9f74987858a44abd80b4cc045c481f7c1/src/primitives/Cone.jl#L13>

which I’m pretty sure will just work as a replacement.

cc @lazarusA

---

<div class="post-metadata">

### Author: ![lazarusA](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lazarusa/32/6571_2.png) [@lazarusA](https://discourse.julialang.org/u/lazarusA)
#### Post date: [November 19, 2025, 5:42pm UTC](https://discourse.julialang.org/t/problems-with-glmakie/133922/6 "2025-11-19T17:42:56Z")

</div>

> [@technocrat](#):
>
> ```julia-auto
> function Kone(; quality = 10)
> # Create base circle points
> base_radius = 0.5f0
> base_points = Point3f[]
> for i in 0:quality-1
> angle = 2π * i / quality
> x = base_radius * cos(angle)
> y = base_radius * sin(angle)
> push!(base_points, Point3f(x, y, 0))
> end
>     
> # Apex point
> apex = Point3f(0, 0, 1)
>     
> # Create faces connecting base to apex
> faces = TriangleFace{Int}[]
> for i in 1:quality
> next_i = (i % quality) + 1
> # Triangle: base point i, base point next, apex
> push!(faces, TriangleFace(i, next_i, quality + 1))
> end
>     
> # Base circle face
> base_face_indices = collect(1:quality)
> for i in 2:quality-1
> push!(faces, TriangleFace(1, i, i + 1))
> end
>     
> # Combine all points
> all_points = vcat(base_points, [apex])
>     
> return GeometryBasics.Mesh(all_points, faces)
> end
> 
> cone = Kone()
> 
> ```

yeah, not sure about the new `Cone` from Geometrics, I do like to control the level of quality, for now I will update the script with @technocrat suggestions.

---

<div class="post-metadata">

### Author: ![ffreyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffreyer/32/21569_2.png) [@ffreyer](https://discourse.julialang.org/u/ffreyer)
#### Post date: [November 21, 2025, 2:49am UTC](https://discourse.julialang.org/t/problems-with-glmakie/133922/7 "2025-11-21T02:49:59Z")

</div>

You can control quality by wrapping primitives in `Tessellation(primitive, quality)` in GeometryBasics. `GeometryBasics.mesh(Tessellation(Cone(...), 2 * quality))` should be equivalent to `Kone(; quality)`. (The 2x quality is because Cylinder equates quality with the total number of vertices and Cone is written to match up with the same quality setting.)
