Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL-ES 2.0 VS OpenGL-ES 1.1, which is faster?

I've written an app using OpenGL-ES 1.1, but am wondering if there are speed gains to be found by switching to 2.0. Has anyone done any tests with large polygon count models? I only want to render triangles that have different colors, nothing fancy. However, I am wanting to render about 1 million triangles for my comparison test.

like image 587
Davido Avatar asked Apr 15 '11 20:04

Davido


2 Answers

OpenGL ES 1.1 and 2.0 provide two very different ways of doing 3-D graphics, so I don't know that direct performance comparisons make much sense. You're probably going to see identical performance using both if you create 2.0 shaders that just simulate OpenGL ES 1.1's fixed function pipeline. This is backed by Apple's documentation on the PowerVR SGX, which says:

The graphics driver for the PowerVR SGX also implements OpenGL ES 1.1 by efficiently implementing the fixed-function pipeline using shaders.

For rendering basic, flat-colored triangles, I'd suggest going with OpenGL ES 1.1 simply because you'll need to write a lot less code. If you are able to get by with the built-in functionality in 1.1, it's usually easier to target that version. You also have a slightly larger market by being able to target the (now) minority of iOS device owners with hardware that doesn't support 2.0.

However, OpenGL ES 2.0 lets you do a whole lot more using its vertex and fragment shaders than 1.1 does, so some of the things that you might do with extensive geometry can instead be handled by shaders. This can make for better-looking, faster effects.

For example, I'm finishing an update to my molecular renderer using 2.0 shaders that will significantly increase resolution of the visualized structures. I'm doing this by using custom shaders that generate raytraced impostors for the spheres and cylinders in these structures. These objects look perfectly round and smooth at any magnification. Doing this in OpenGL ES 1.1 with pure geometry would be all but impossible, because the number of triangles required would be ridiculous (also, billboards wouldn't work well for my cylinders, and the intersection of these shapes wouldn't be handled right in that case).

A million triangles might be a bit much for these devices. In my benchmarks, the old iPhone 3G did around 500,000 triangles per second, and the first-generation iPad about 2,000,000. I haven't fully benchmarked the much faster iPad 2, but my early tests show it at about 8,000,000 - 10,000,000 triangles per second. Even on the fastest device out there, you're only going to get ~10 FPS on a million-triangle scene in the best of the devices. Odds are, you don't need that size of geometry, so I'd do what I could to reduce that first.

like image 126
Brad Larson Avatar answered Oct 17 '22 14:10

Brad Larson


The performance gains in ES 2.0 aren't from rendering single VBOs, but through

1) performance tweaks in custom shaders to do only the bare minimum required rather than more general fixed functions

2) rendering lots of objects due to the streamlining of the matrix pipeline and the removal of the matrix stack and the "fixed function", which must figure out new shaders on state changes, and the removal of the need for multipass rendering for some effects.

This allows e.g. the CPU to do all dynamic matrix transformations in a separate thread, whilst ignoring static matrices and avoid unneeded transfer between the CPU->GPU. There's no need to continually redo camera matrices between 2D and 3D state changes in shader versions.

like image 29
emacinnes Avatar answered Oct 17 '22 14:10

emacinnes