1

I have a 3D app that currently uses OpenGL ES 1.1, most meshes are hardwired in the app and are static (they don't move), so depth test allows to draw the transparent geometri efficiently, using the hardwired sorting.

Now I want to load the world from a 3D editor, and add some transparent dynamic objects (the geometry can be in any arbitrary order), that causes the depth test to draw "holes" in the geometry from the back, that is being rendered after the geometry in the front using OpenGL ES 1.1 depth test.

I would migrate to OpenGL ES 2.0 any time soon, so I wonder if there is a GPU accelerated sorting to draw the geometry on the back firts, so that the blending is made in the right way.

rraallvv
  • 2,875
  • 6
  • 30
  • 67

1 Answers1

3

OpenGL ES 2.0 doesn't solve any of geometry order problems for you. You still need to sort your objects before issuing OpenGL ES 2.0 draw calls.

keaukraine
  • 5,315
  • 29
  • 54
  • Please see [this extract](http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter46.html). I'm totally new to OpenGL ES Shading Language, but it seems that what I want is not so far from those implementations. – rraallvv Aug 12 '13 at 08:22
  • 1
    Well, that seems to be a hard way. Do it if you dare :) While you might achieve fast sorting with such method, on practice reading color data back from framebuffer is usually so expensive that it can make such optimization useless. – keaukraine Aug 12 '13 at 09:14
  • @rraallvv Well, you *might* be able to implement some GPGPU-sorting algorithm for your needs, yet OpenGL doesn't exhibit anything like that out of the box (conceptually it isn't really sorting your objects with OpenGL, but rather sorting them by a traditional sorting algorithm and misusing OpenGL shaders for computational tasks), and I wouldn't bet on it bringing any advantage for your few objects out there (don't tell me your world has plenty of objects as long as they're not in the leagues of 1e5 or 1e6 at least). – Christian Rau Aug 12 '13 at 09:16
  • @rraallvv And like *keaukraine*'s comment also suggests, while OpenGL ES 2.0 has basic vertex and fragment shaders, it lacks many of the features that allow you to actually use the output of such a GPGPU sorting algorithm for rendering right-away, without a roundtrip to the CPU, that is needed in your case for dispatching the draw calls in the correct order. – Christian Rau Aug 12 '13 at 09:18