package oglsl
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Embedding GLSL in OCaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
0.1.0.tar.gz
md5=7d1303c6cfee60e8bc0258faaec8df33
sha512=1d688ac224242a92f9e786e01218e384c2e76aa7b41137e0160056ad8e2c3a44f333b4b4ab08ff94ac96e697a8b6701f03e9b784222f8974c27684bcb6376138
Description
Oglsl is a set of module signatures providing overloadable functions and operators and abstract types for writing GLSL in OCaml. In other words, it is a tagless-final eDSL - abstract algebra of GLSL embedded in OCaml.
README
Oglsl
Oglsl is a set of module signatures providing overloadable functions and operators and abstract types for writing GLSL ^wiki-glsl in OCaml. In other words, it is a tagless-final ^jfp eDSL - abstract algebra of GLSL embedded in OCaml.
Oglsl isn't useful on its own. (TBA)
Example
An introduction to Oglsl is available at the wiki. For a use case of Oglsl in one short snippet, here it is:
module SHADER
(C: Oglsl.Glsl)
(C_stdlib: Oglsl.Glsl__opengl(C).S) = struct
open C
open C_stdlib
let vertex_shader =
prog begin
(#!) version v3_3_0 core >>=+ fun _ ->
let+ pos = In.ref__vec3 ~layout__location:0 () in
func0 void main @@ fun () ->
Gl.position := Vec4.of_vec3 !pos (float 1.0)
end
end
which translates to (assuming we provide an interpreter implementation):
#version 330 core
layout(location = 0) in vec3 pos;
void main() {
gl_Position = vec4(pos, 1.0);
}
Let's dissect what's going on:
- TBA
- TBA
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page