views:

371

answers:

2

If I want to render just a huge map, what is the best practice when using OpenGL ES with a mobile device (Android or iPhone based)?

What is the best structure to contain all the vertices, normales and texture coordinates?

I guess using a interleaved structure may give you some performance benefits caused by memory caching. Ok?

Should I use drawArrays or drawElements to push my data to OpenGL ES?

Well, I did no testing at all but I might think, that drawElements might be faster if the GFX does not use shared memory since you do not have to push that much data. Since this is really close to metall, what do you think? (the iPhone is ARM based while the Android platform is Qualcomm based (also an ARM?))

Best regards,

Friedrich

A: 

I like the approach presented in this presentation. Check out slides 26-32.

The presentation is android specific but should apply to the iPhone as well. Basically, check your GL extensions, and if you can use them Vertex Buffer Objects are the way to go.

Remember that your target architecture (ARM in both cases) is probably not going to have an FPU, so state changes are going to be very very expensive.

Dinedal
+1  A: 

In theory using Vertex Buffer Objects should yield the best results. You have already given the reasons.

Although I remember hearing in one of the Stanford lectures on iPhone-development, that the use of VBOs does not produce better performance than using vertex pointers. Then again, this information is a bit dated. So, going for VBOs on the iPhone will definitely not be a bad idea.

Up until Android 1.5 there was a memory leak in the OpenGL-implementation that was triggered by glDrawElements. Although I would assume that it has been fixed by now, I haven't checked it in a while.

And here some Infos on how to best use VBOs.

Stefan Schmidt