An open API service indexing awesome lists of open source software.

https://github.com/lbirkert/svelte-ogl

typed port of OGL to svelte components.
https://github.com/lbirkert/svelte-ogl

frontend ogl svelte sveltejs sveltekit typed typescript webgl

Last synced: 2 months ago
JSON representation

typed port of OGL to svelte components.

Awesome Lists containing this project

README

        

# svelte-ogl

A port of [OGL](https://github.com/oframe/ogl/) to Svelte. Fully typed.

```
npm i -D svelte-ogl
```

## Example

```html

import { Canvas, Camera, Mesh, Scene } from "svelte-ogl";
import { Program, Plane } from "ogl";

const uniforms = {
time: { value: 0 },
};

uniforms.time.value = e.detail.time / 1000}
>


new Program(gl, {
vertex: /* glsl */ `
attribute vec2 uv;
attribute vec2 position;
varying vec2 vUv;

void main() {
vUv = uv;
gl_Position = vec4(position, 0, 1);
}
`,
fragment: /* glsl */ `
precision highp float;
uniform float time;

void main() {
gl_FragColor = vec4(vUv * sin(time), 1, 1);
}
`,
uniforms
})}
geometry={(gl) =>
new Plane(gl, {
width: 2,
height: 2
})}
/>

```

## Report Bug

Please refer to the [issues](https://github.com/KotwOSS/svelte-ogl/issues) page!

## Feature Request

Please refer to the [issues](https://github.com/KotwOSS/svelte-ogl/issues) page!