how to cache sin cosine?

hi how can i cache sin or cosine?
up to were should i cache??? i use sin for creatign soem shapes like sphere but i use it a lot on othre places i found that it is best fast to cache it but how could i ?? an array? yeh but up to where??? any tuts??

hvea yuo teird raednig a book no lookpu talbes? whta deos thsi haev ot od iwth poenlg?

i od x=sin(a) for my ccahe.

Besides, if you’re creating a sphere, all the computations are cached quite naturally in the vertex positions themselves, so I really don’t see the point of your question. If you’re creating the vertex positions each time you render your sphere, think again.

what strobe says is: if you use display lists or vertex arrays, you have to calculate the vertex
positions only once, thus eliminating any performance issues based on the calculation of sin/cos.


And if you dare, look at vertex buffer objects.

strobe thx for pointing out how studpid i sound
i am dyslexic thx for remidng me my ‘gift’.

in my paper it say i must be abel to make the fastst rendring with out usin g any list or fbo and that is a way for knowin what can be optimzed and up to what points

i didnt wantet you to make my homewoerk just to teach me abut the cache of sin

Wow, Doodlemunch, I’m sorry baby! I didn’t mean it, honest!


No hard feelings? I know I can be a bit terse and insensitive at times. No offence intended.

Yeah, store your sphere’s vertex positions in an array, or is that against the rules?

By the way, I have a gift too, but nobody wants what I got :smiley:

We could talk about caching trig functions, but there’s not much to it really. Besides, is this the place for such a discussion? :wink:

not the place but lots of experienced people i guess in here

i tried an empty loop with lots of iterations it only had a sinus call inside and i measured the tiem it took to go trough then i did a small bake of the sinus in an array and called teh array in the second tst to see if it took longer or shorter than before and it did took shorter that is y i want to know how to correttely bake sinus into an array

what is ur gift, a ruler?

Another thing you might want to look into is using GL_TRIANGLE_FAN / GL_TRIANGLE_STRIP to optimise your rendering if you haven’t already done so.

With a sphere, for example - use a triangle fan for the top and bottom and a strip for each “band”.