guides:gpu
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
guides:gpu [2024/05/31 22:38] – osnr | guides:gpu [2024/07/16 20:20] (current) – Add time, remove TODO b/c it works admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== GPU FFI ====== | ||
+ | |||
The new 'GPU FFI' lets you write vertex and fragment shaders to draw things. | The new 'GPU FFI' lets you write vertex and fragment shaders to draw things. | ||
Line 31: | Line 33: | ||
You can make '' | You can make '' | ||
+ | |||
+ | ====== Adding functions ====== | ||
+ | |||
+ | When you want to use functions, maybe to [[https:// | ||
+ | |||
+ | < | ||
+ | # source: https:// | ||
+ | # cosine based palette, 4 vec3 params | ||
+ | Wish the GPU compiles function " | ||
+ | return a + b*cos( 6.28318*(c*t+d) ); | ||
+ | }} | ||
+ | |||
+ | Wish the GPU compiles pipeline " | ||
+ | {vec2 p0 vec2 p1 vec2 p2 float u_time} { | ||
+ | vec2 vertices[4] = vec2[4](p0, p1, p2, p0); | ||
+ | return vertices[gl_VertexIndex]; | ||
+ | } {fn palette} { | ||
+ | vec3 gradientColor = palette(gl_FragCoord.x, | ||
+ | return vec4(gradientColor, | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Wish $this is outlined blue | ||
+ | When $this has region /r/ & the clock time is /t/ { | ||
+ | set r' [region move $r down 100%] | ||
+ | Wish the GPU draws pipeline " | ||
+ | }</ | ||
+ | |||
==== TODO: Document internal Gpu:: API ==== | ==== TODO: Document internal Gpu:: API ==== |
guides/gpu.1717195091.txt.gz · Last modified: 2024/05/31 22:38 by osnr