Draw a point or circle with X,Y coordinate from fragment shader

Is there a way to draw a pixel from fragment shared at X,Y coordinates.

I iterate thorough the texture that contains the coordinates in R and G and i will sue those numbers to draw a point in the screen. For now i use 0-255 then once i solve this problem i can move on to another level using floats or using R and G for 16 bit precision.

Thanks

A fragment shader cannot modify gl_FragCoord, and cannot affect framebuffer pixels other than the one for which it is invoked (whose position is stored in gl_FragCoord).

It can modify arbitrary pixels in an image via imageStore().

I don’t think i can use imageStore() in webGL :S

I guess i have to iterate through all the sparse texture and find if the value belongs to that pixel.

Thanks

Or you could just do the conversion from a “sparse texture” to a regular texture on the CPU and upload it. It’d almost certainly be faster than doing potentially hundreds if not thousands of texture fetches every frame.

Yes i have a 2k by 2k texture now and that is all i need, but i have another problem. I need to iterate through that texture that has normalized data and i need to somehow draw a pixel if the latitude and longitude in the texture are within a small delta value that i give. I have posted another question on this. how can i iterate with loop in sampler2D - OpenGL: Basic Coding - Khronos Forums

This is for a prototype in Data Viz class but this seems a research question that the professor has for such a long time and it is a hard problem as he already mentioned.

Thanks for help guys