Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Optimizing OpenGL ES Applications for Brew : Page 2

Although OpenGL ES makes 3D graphics programming significantly easier and more portable, developers must still work to tune their applications for the greatest performance possible. This article features tips and tricks gleaned from the experts.


advertisement
Managing Models
Your models are the bread and butter of your OpenGL application; without models, what is there to see in the scene? Your models consist of vertices, potentially a lot of them. As a result, you should always use fixed vertex array types and formats, such as GL_FIXED, GL_SHORT, and GL_UNSIGNED_BYTE using tightly packed vertex arrays. These perform significantly faster than their floating counterparts; degradation in rendering performance of up to 50 percent is possible by being naïve in your choice of types. This degradation is due both to the larger size of the slower representation as well as the performance impact of the GPU having to convert those types to native types before processing. The following table shows what types are appropriate for each kind of data.

Position Array



GL_FIXED, GL_SHORT

Color Array

GL_UNSIGNED_BYTE

Tex Coord array

[st] or [stq], GL_FIXED, GL_SHORT

Normal Array

GL_FIXED, GL_SHORT

In a similar vein, try to avoid large numbers of very small triangles. Given the hardware on which you're running, you're not likely to see an improvement in image quality and will spend needless time in rendering. A good trick is to try to optimize your model into strips of triangles—these strips share vertices with adjacent triangles, meaning you're getting the greatest possible detail relative to the number of vertices you're using. Triangle strips benefit the whole pipeline by sharing the number of vertices per triangle to send across the bus. (This optimization works well for platforms with external processors, too!)

Another area to pay attention to is static clipping: you want small models to avoid static clipping, but not too small, or else you'll end up with too many vertices to render per unit time to get right. This can be tricky to optimize, so you'll want to make time for experimentation.

Finally, an obvious strategy is to reduce level of detail for distant objects from the camera. It makes little sense to render lots of vertices on an object that the rendering engine's going to end up drawing as a few colored pixels anyway! You can do this in a number of ways, including keeping various models around and selecting a model with the optimum number of vertices based on its position in the scene, especially if the model isn't likely to move a great deal towards or away from the camera.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap