mrdoob / glsl-sandbox

Shader editor and gallery.
https://glslsandbox.com/
MIT License
1.56k stars 263 forks source link

custom textures #40

Open makc opened 8 years ago

makc commented 8 years ago

subj :)

screen shot 2015-10-31 at 14 12 36

makc commented 8 years ago

oh yes, demo link :leaves:

koreus7 commented 8 years ago

Bump! This is very cool. would love to see this merged.

Should they be upside down though or do I just not understand sampler 2D?

precision mediump float;

uniform vec2 resolution;
uniform sampler2D rings; // http://i.imgur.com/tVVAVLL.jpg
void main( void ) {

    gl_FragColor = texture2D( rings, ( gl_FragCoord.xy / resolution.xy ) );

}

This example makes the upside down thing more obvious

makc commented 8 years ago

you can do gl.pixelStorei (gl.UNPACK_FLIP_Y_WEBGL, xxx) to flip it the way you want to.

makc commented 8 years ago

actually, why not add it, indeed...

makc commented 8 years ago

ok done, but... crap:

This branch has conflicts that must be resolved

makc commented 8 years ago

ha, so github does understand forced push )

makc commented 8 years ago

I guess @mrdoob would merge this way faster if I did not use dick pic as example :wink:

hermanbanken commented 7 years ago

Just use some other picture: head

makc commented 7 years ago

@hermanbanken well, maybe @mrdoob hates the idea any way. you know, like in old demoscene days, using bitmaps instead of code was frowned upon

koreus7 commented 7 years ago

Maybe @mrdoob doesn't want glslsandbox to turn into Shader Toy. Also links to images could go dead meaning more broken shaders.

PS: Would be cool to see some shaders that mimic oldskool demoscene stuff.

mrdoob commented 7 years ago

Hmm, the issue is that this wouldn't scale and it would increase the shader size considerably...

makc commented 7 years ago

@mrdoob if you use data url, yes. but, as you see, imgur url works just as good

makc commented 7 years ago

@mrdoob and, in fact, any other host that allows cross-domain access