I want to use Processing shaders to do some code art algorithms - but I want to do it all through a shader to take advantage of the high GPU power.
I know the basics of shader programming, but what I’m stuck on at the minute is,
how would I draw a bitmap on top of another bitmap (if I have 2 2dsamplers for example)
how could I get the individual pixel color from an x,y position on either of these bitmaps
how could I change / write the value of a new color into a bitmap at an x,y pixel position.
- You can’t. The result of the fragment shader IS the new bitmap.
#version 320 es
precision highp float;
precision mediump int;
in vec4 vertTexCoord;
out vec4 was_gl_FragColor;
uniform sampler2D texMap;
thanks, i’ve worked out other solutions…
well,I didn’t really, just had compromise - I worked out texelfetch though, which was very useful - but I still want to know how to simply write / store a pixel into a texture already in GPU memory e.g. the uniform sampler2D texMap - how would i write a single pixel into an x,y there?