hi Alberth,
thanks for reply.
I know that I can do what you said by using glUniform2f() to pass values to shader, but then I also has to use 2 forloop to pass them to shader, that defeats the purpose of using GLSL; there is no parallism at all. and that is what i am looking for:parallism
You don't need the loops. I wrote a post earlier but didn't click submit when I realised you were doing Julia Sets (where the c value would remain the same and thus Alberth's answer was enough). For your Julia Sets it's this bit that calculates the z value (or c if you were doing Mandelbrot):
z.x = 3.0 * (gl_TexCoord[0].x - 0.5);
z.y = 2.0 * (gl_TexCoord[0].y - 0.5);
Normally you would set set your c value in your loops (for Mandelbrot at least) but this isn't possible to do in a pixel shader because the pixel doesn't really know where it is. It doesn't know if it is the first pixel, the 5th, the last. It doesn't know if it is in the top row, along the left edge or any of that useful stuff you will need. Also you are not in control of any looping any more so you can't give any of those values. Fortunately what you can do is give the shader code the information it needs to be able to calculate the values itself.
Because of how the quad has been setup with texture coordinates, you can use those texture coordinates in the pixel shader to work out where on the quad you are. For example, the top left of the quad has texture coordinates (0, 1). In the pixel shader then you will have:
z.x = 3.0 * (gl_TexCoord[0].x - 0.5);
z.y = 2.0 * (gl_TexCoord[0].y - 0.5);
becomes:
z.x = 3.0 * (0 - 0.5) = -1.5
z.y = 2.0 * (1 - 0.5) = 1
Thus the z value for that pixel becomes -1.5, 1.
Consider what happens in the middle of the quad; the texture coordinates are 0.5, 0.5 and so:
z.x = 3.0 * (0.5 - 0.5) = 0
z.y = 2.0 * (0.5 - 0.5) = 0
z becomes 0, 0 which makes sense since that is the center.
So using texture coordinates (and scale, center as in the Mandelbrot version) the shader is able to calculate it's z (or c) value rather than you having to pass it for each pixel (which would be much slower since you'd have to pass it using a texture possibly).
For the Julia Set the 'c' value will remain the same for every pixel so Alberth's answer should be enough fot hat since you only need to do it once.
I think it might be of benefit to you if you read up on how shaders work and how they interpolate the output of the vertex shader for each fragment.
This approach does have some downsides too. It uses floats so you'll be limited to have far you can magnify your image and it also does a lot of work each frame (it is rebuilding the entire thing each time). A better approach might be to render it to a texture once and then simply show that texture each time afterwards using a basic shader.