Performance of arc mesh/shader vs ellipse function

@bee some new info:
1/ i have checked on my ipad1: i cobfirm the image is pixellized.
2/ settling the pixelsize x3 gives a non-pixellized result, but smooth edge (not sharp).
3/ the straight lines are still pixellized, but this could be solved at the same cost as for circle: fuzziness of the border. Is it acceptable? (i wont do the work if you consider that x3 is too fuzzy).
4/ i think there is a solution for speed and sharpness: associate my method and andrew’s. What i mean is:
4.a/ draw the surface with my method (and forget the sahder, just make pixellized edges). This will fill the surfaces very quickly.
4.b/ on top of that, draw the edges with andrew segment shader. This will be perfectly sharp and very quick because only a few pixels will be updated.
But this is much work. Is it worth it? It depends on why you want these circles for (you’ve not explained it in details).

@andrew_stacey: I just noticed that your code also doesn’t anti-aliased the radius line (the straight line). I didn’t notice it before because my test program use ROUND linecap as the default. Pardon my lack of understanding of shader, but how did you draw the round cap? Which line is it in the code? Any hint how to anti-alias the line as well?

What do you mean by…

The idea of the shader is that the mesh is a series of rectangles running from (-.5,0) to (.5,1)

Why .5? I still don’t get it. :frowning: It seems that each mesh has its own coordinate within it. Am I right? Do you have any reference to study about this openGL shader things? Codea’s doc about shader doesn’t give me enough informations. Or perhaps I didn’t read enough.

@jmv38: I don’t really like the idea of image scaling. Yes, it boosts the performance, but I don’t quite like the result. It’s too blurry. CMIIW. If you think the work is too much, then don’t bother to write code sample for me. :slight_smile: I just need hints and direction how to do it, let me write the code myself, if you mind to provide code sample. Your explanation above is quite clear to me. Thank you.

My biggest problem here –as I said since the beginning– is with the shader. I still don’t really understand how does the shader work with mesh and how to draw using shader. What’s uniform? What’s varying? Etc. Some of its functions are a bit different from Lua’s counter part. It’s like a whole different alien world separated from Codea.

@bee thanks for the feedback. I’ll see if i can do something to get really sharp edges, but no garantee.
Concerning shaders: before i made my shader bench (on CC) i was completely lost with shaders. I had a week of vacations so i read Ignatz tuto on shaders, and more the links at the end of his tuto: the shader spec and quicksheet. Then i programmed step by step, starting from smoothing shader and including more and more variants. After one one week it was about clear to me how shaders work (although i am not very gifted at programming them). So you can surely do the same (pbly faster) when you’ll decide to. It is not really complex, ignatz tuto will answer your questions above. :slight_smile:

i have tried 4.a + 4.b but it doesnt work: the speed is ok, but the edges are not correctly masked… :((

just because it is nice visually, here is what happens:

I found link to @ignatz’s shader tutorial ebook by searching this forum. Unfortunately, the link that refers to the file in Ignatz’s dropbox is no longer active. I can read some articles about shaders in Ignatz’s blog. But I want the ebook so I can read it offline. If someone here got the ebook, would you please reshare it for us here? Thank you.

@bee - Oops, I moved some files and broke the links

I have relinked them here:
https://www.dropbox.com/sh/mr2yzp07vffskxt/AACqVnmzpAKOkNDWENPmN4psa

Thank you, @ignatz. Btw, can you help me with this arc problem? :slight_smile:

@bee - sorry, I’m not very active in Codea any more, so I can’t help with the arc problem (also, I suspect it involves a lot of math!)

Start with my ebook, which should answer many of your questions about shaders, and look around for something on arcs, eg google “openGL arc shader”

@Ignatz

sorry, I’m not very active in Codea any more

Only temporarily, I hope.

@ignatz have you another hobby now?

@Jmv38 - its more that I’ve done everything I can in Codea (not necessarily very well, because I don’t have a talent for graphic programming or design), and am lacking inspiration for where to go.

I have been occupying myself by learning Python in the meantime, but it’s not the same.

Hopefully I’ll get my interest back soon.

inspiration attempt: what about: write some user library that could later be made native…?