for learning purposes I decide to draw a sphere using 3 methods
I read that using ibo makes program runs faster, but is this really true? For a sphere of 100 slices and 100 stacks 2nd method produces 40400 vertices while 3rd "only" 19802.By doing that I save 20598vertices each 32bytes = 659136 bytes.
verticesSize=(slices*4)*(stacks+1);
IBO verticesSize=(slices*2)*(stacks-1)+2;
However I need to make array of indices which in this case is a size of 118800(number of indexes needed to create all faces)*4(size of unsigned int)=475200 bytes! While 2nd methods renders 1000 spheres with 15fps ,the 3rd renders 1000 with barely 6pfs
Or maybe I wrote my code completely wrong and that why it struggles so much :( If someone is interested ,here is my code http://pastebin.com/raw.php?i=74jLKV5M
The glDrawElements call is wrong. The count parameter should be the number of indices, not the number times 4. Try changing that.
Using indices instead of triangle strips should almost always be faster. In fact I wouldn't be surprised if the driver was using indices behind the scenes to render triangle strips as well.
Also as I mentioned in the comments, the order in which you have your indices can impact the performance. However for your sphere, the indexing pattern you are using is probably the most optimal, and even so, the difference it makes is small.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With