I want to change a single pixel on a texture that I have attached to my shader.
There must be a simple function.
tex2D(sampler,uv) is for reading it out and returning that pixels color.
I need a function that manipulated that pixels color and writes it back on the texture.
That shouldn’t be that difficult, but I couldn’t find it.
Yes, it should be.
Arbitrarily writing to a texture is not a trivial or simple thing. Information flows in very specific directions in OpenGL: into shaders. The only outputs allowed from shaders are (usually) the actual shader output variables. That’s how you write to the framebuffer, for example. Vertex/Geometry shader outputs can also be fed to transform feedback buffers.
Now, if you have GL 4.x-class hardware, you can write to images using ARB_shader_image_load_store (which is core in GL 4.2). However, the minute you turn this on, you take full responsibility for synchronizing access to memory.