/ShaderAbstractions.jl

A backend independent shader API (For e.g. OpenGL WebGL and Vulkan)

Primary LanguageJuliaMIT LicenseMIT

ShaderAbstractions

Build Status Build Status Codecov

Abstractions to construct shader objects for any WebGL/OpenGL/EGS/Vulkan context! You construct the objects, and then render them in any backend.

using ShaderAbstractions, LinearAlgebra
using ShaderAbstractions: VertexArray
using Test, GeometryBasics
import GeometryBasics

struct WebGL <: ShaderAbstractions.AbstractContext end

m = GLNormalMesh(Sphere(Point3f(0), 1f0))

mvao = VertexArray(m)
instances = VertexArray(positions = rand(GeometryBasics.Point{3, Float32}, 100))

x = ShaderAbstractions.InstancedProgram(
    WebGL(),
    "void main(){}\n", "void main(){}\n",
    mvao,
    instances,
    Dict(
        :model => Mat4f(I),
        :view => Mat4f(I),
        :projection => Mat4f(I),
    )
)