https://github.com/racerxdl/gotoyrender
ShaderToy like Go-Lang Render
https://github.com/racerxdl/gotoyrender
glsl golang neon-parallax shaderlab shaders shadertoy star
Last synced: 2 months ago
JSON representation
ShaderToy like Go-Lang Render
- Host: GitHub
- URL: https://github.com/racerxdl/gotoyrender
- Owner: racerxdl
- License: apache-2.0
- Created: 2019-09-15T18:11:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-13T17:47:32.000Z (almost 6 years ago)
- Last Synced: 2024-05-02T01:25:49.450Z (over 1 year ago)
- Topics: glsl, golang, neon-parallax, shaderlab, shaders, shadertoy, star
- Language: Go
- Size: 139 KB
- Stars: 9
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go ToyRender
ShaderToy like Go-Lang Render compatible with [Pixel](https://github.com/faiface/pixel) SpritesIt still WIP and doesn't present many of the ShaderToy features. But it does run some nice shaders.
### Usage
```go
package mainimport (
"github.com/faiface/pixel"
"github.com/faiface/pixel/pixelgl"
"github.com/racerxdl/gotoyrender/toy"
"golang.org/x/image/colornames"
)func run() {
cfg := pixelgl.WindowConfig{
Title: "Sample",
Bounds: pixel.R(0, 0, 1024, 768),
}
win, err := pixelgl.NewWindow(cfg)
if err != nil {
panic(err)
}tr := toy.MakeToyRender(720, 480)
tr.SetFragmentShaderPiece(`
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
vec2 position = 2. * (fragCoord.xy / iResolution.xy) - 1.;
vec3 colour = vec3(0.0);
float density = 0.15;
float amplitude = 0.3;
float frequency = 5.0;
float scroll = 0.4;
colour += vec3(0.1, 0.05, 0.05) * (1.0 / abs((position.y + (amplitude * sin(((position.x-0.0) + iTime * scroll) *frequency)))) * density);
colour += vec3(0.05, 0.1, 0.05) * (1.0 / abs((position.y + (amplitude * sin(((position.x-0.3) + iTime * scroll) *frequency)))) * density);
colour += vec3(0.05, 0.05, 0.1) * (1.0 / abs((position.y + (amplitude * sin(((position.x-0.6) + iTime * scroll) *frequency)))) * density);
//
fragColor = vec4( colour, 1.0 );
}
`)//tr.SetTextureData(0, img) Sets the iChannel0 texture to img
for !win.Closed() {
tr.Render()win.Clear(colornames.Wheat)
tr.Draw(win, pixel.IM.Moved(win.Bounds().Center()))
win.Update()
}
}func main() {
pixelgl.Run(run)
}```
### API
*TODO*
### ShaderBasis (cmd/shaderbasis)

### Star based on flight404 (cmd/star)

### Neon Parallax by @stormoid (cmd/neonparalax)

### Digital Brain by srtuss (cmd/digitalbrain)
