Timeline for OpenGL - drawElements 2D imposible z-sorting (textured)
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 11, 2013 at 16:14 | comment | added | Justin | Sorting by texture is an optimization. Sorting by depth is, as you describe it, a requirement. You optimized too early. Roll back your optimization, sort your draw calls in a way that gets the output you want, THEN optimize as necessary. | |
| Sep 9, 2013 at 15:36 | comment | added | Amit Assaraf | This is the problem, I sort objects into one draw call according to which texture they use. so i have all objects that use texture id 1 in one draw call and so on. So that means all objects in a texture will have the same "Z" value because they are drawn together. | |
| Sep 8, 2013 at 21:13 | comment | added | Sean Middleditch | ... why? You can sort your draw calls just fine, and switch the texture before each draw. Use bobobobo's excellent advice about texture atlases to avoid the overhead of texture/state changes. | |
| Sep 8, 2013 at 19:04 | comment | added | Amit Assaraf | But the draw calls are per texture meaning i cant sort per object | |
| Sep 8, 2013 at 18:15 | comment | added | Sean Middleditch | The part where you said you can't sort. Your description of why you said you can't makes no sense; your VBOs should only have 2D position coordinates since they're sprites, no Z values. Just sort your draw calls. Use matrices/shaders to alter the Z value of an entire individual game object (not the contents of a VBO) if you need it. Drawing sprites with translucency is an old, solved problem; bobobobo and I have told you how it's done in real, shipping, professional games. | |
| Sep 8, 2013 at 13:27 | comment | added | Amit Assaraf | Prehaps you could simply tell me what is my misconception? | |
| Sep 7, 2013 at 19:43 | comment | added | Sean Middleditch | Do not use that kind of language. You are doing things wacky and wrong. Simple. Your misconception about why you can't sort is just that: a misconception. | |
| Sep 7, 2013 at 17:30 | comment | added | Sean Middleditch | There are zero good reasons why you should not be able to sort; if you think you can't, you must be doing something really wacky and unnecessary. There's no simple fix for "I did my whole rendering engine wrong." | |
| Sep 7, 2013 at 15:14 | comment | added | Amit Assaraf | Also depth peeling seems like a lot of work for a simple 2D application. Still looking for an answer. | |
| Sep 7, 2013 at 15:11 | comment | added | Amit Assaraf | Again, I cannot sort because of the VBO issue. | |
| Sep 7, 2013 at 10:12 | comment | added | Amit Assaraf | I heared about depth peeling but I was told not to get into it if it's for a simple 2d application. Also I know about the fact that you can simply sort the objects and render back to front but it's impossible because of the way I render currently. Read above. And about you one before last suggestion, I'll give it a shot and report in. | |
| Sep 7, 2013 at 4:39 | history | answered | Sean Middleditch | CC BY-SA 3.0 |