SFML community forums

General => General discussions => Topic started by: Tank on April 16, 2013, 10:39:23 pm

Title: Z ordering
Post by: Tank on April 16, 2013, 10:39:23 pm
Hello guys,

I recently faced the lack of a z ordering mechanism in SFML (http://en.sfml-dev.org/forums/index.php?topic=7329.msg77315#msg77315) and want to start a little discussion about


A brief overview of the problem

SFML's graphics module is written for 2D graphics. Although using an OpenGL backend, which is per se a 3D graphics API, it uses 2D vectors for all its high-level features.

One difference between 3D and 2D is that using the third dimension (depth), objects can be in front or behind other objects. That effect is also widely used in 2D applications/games to suggerate depth (e.g. the player in front of a fancy mountain parallax background).

To make objects appear in front of others, SFML makes use of overdrawing: Whatever is rendered last will overdraw what has been rendered before. That, in turn, means that you have to do the depth ordering (or z ordering) yourself, by taking care of the order you render your drawable things.

OpenGL (and other APIs) however offers a so called depth buffer, which will give exactly that task to the graphics processing unit. There are some special cases where you still have to take care of what you send first, but generally you don't have to pay that much attention anymore. The whole process gets easier and also (theoretically) faster.

My question is: Are there users (besides Nexus ;)) who already missed that feature badly? Laurent, would you consider z ordering to be in SFML's scope at all? If not, what can we do to externally extend SFML in a way to support that? (e.g. in extension libraries like Thor, which already has plenty of neat additional SFML candy)
Title: Re: Z ordering
Post by: ZackTheHuman on April 16, 2013, 10:48:53 pm
I would find such a feature extremely valuable for the kind of games I'm working on. Right now I am doing manual "z-ordering" but it would be nice if the GPU could handle it for me.
Title: Re: Z ordering
Post by: Cornstalks on April 16, 2013, 11:00:18 pm
I requested a depth axis once (http://en.sfml-dev.org/forums/index.php?topic=7535.5), only to realize depth testing is completely useless once you start using textures that have transparency, which make up the majority of my sprites (and many other peoples').

I think too many people use alpha blending too often to make this feature very useful. I imagine it would require a substantial change for little net gain.
Title: Re: Z ordering
Post by: Tank on April 16, 2013, 11:29:07 pm
Well, translucent stuff just needs to be rendered front-to-back, that's it. That's what I meant with "special cases". But those could be of course considered, too.
Title: Re: Z ordering
Post by: binary1248 on April 17, 2013, 10:10:22 am
I can't believe you forgot SFGUI, back then when we still used SFML for rendering ;). It was so cool having to sort widgets back to front before flushing the RenderQueues every frame. I even wrote a special bubblesort implementation for that. If SFML had real depth support it would make life easier for me when I write the SFML VA renderer... some time in the future ;).

Quote
The whole process gets easier and also (theoretically) faster.
Depends on what you consider "easier". Sure for people who understand how the depth buffer works, they just specify an extra coordinate and thats it. But for beginners in graphics programming, who Laurent holds so dear, the "painter's algorithm" way of doing things is more intuitive and hence easier to learn. If this becomes a feature then at least make it optional and off by default, so that the learning curve doesn't become too horrible.

(theoretically) faster: in theory it only makes things faster if you already had a high degree of overdraw before turning depth testing on. Because the render pipeline can discard fragments earlier if it notices that geometry exists with a higher depth value than the fragment it currently wants to render, it just saves the fragment shader and buffer op steps of the pipeline. This is so unpredictable because early depth test implementation differ so much, you really can't tell if depth testing will even make things faster in all cases. In some it might even slow things down because e.g. you have an extra buffer to clear every frame etc. You need to conduct application specific testing to determine whether depth testing is worth it on a case by case basis. Another reason to make this optional.

http://www.opengl.org/wiki/Early_Depth_Test
Title: Re: Z ordering
Post by: Laurent on April 17, 2013, 10:38:51 am
I'm not against this feature. And it can definitely not be implemented externally. Using a sorted list of drawables could work, but it's not the best solution. And it doesn't solve your initial problem: having different depth values within the same entity (the particle system's vertex array).

But there are negative points (most important last):

1. Depth buffer may not always be available: today's GPUs all have it, but I don't know, maybe a crappy driver or weird configuration can lead to a lack of depth buffer

2. What if user disables it in its sf::ContextSettings? SFML would not be able to work correctly. And if it changes it to 8 or 24 bits per pixel instead of 32? The valid range for Z values is changed, and with 8 bits is becomes really low (only 256 Z values available).

3. While it's ok for high-level entities to have a 'z-index' property that may or may not be used, sf::Vertex would have a sf::Vector3 for its position, even if you don't use depth. It's not a big deal but it's less convenient when your app has sf::Vector2 everywhere else.

4. The default behaviour (i.e. not using depth) would result in all vertices having the same Z component. Which leads to the well known problem of Z-fighting (http://en.wikipedia.org/wiki/Z-fighting). The only solution would be to disable depth testing/writing for entities that don't use depth, but it makes the API even more complicated since you have two properties: z-enabled and z-index. And to be applicable at low-level (with vertex arrays), I'd have to add it to the render states as well.

5. Transparent entities. This is a major problem, since most sprites will have transparency, as already mentioned by Cornstalks. I wouldn't call this a "special case", but rather the common case. I expect many messages on the forum about this, if we do it ;)

If you have an answer to all these problems, I'm ready to work on it :P
Title: Re: Z ordering
Post by: binary1248 on April 17, 2013, 12:30:17 pm
1. Provide something like sf::isDepthBufferAvailable() or something similar to how you check for shader support.

2. If the depth buffer is disabled in the sf::ContextSettings, just don't enable depth testing. Nothing will happen with the third coordinate then, if you are using an orthographic projection. Your conception of the depth buffer precision is also not correct. You assume there is a direct uniform mapping from our values to the "true" internal values that the GPU uses during rendering. If you read this (http://www.opengl.org/archives/resources/faq/technical/depthbuffer.htm), they explain that it is in fact a non-uniform mapping from your values to whatever values are available from the range that the size of the depth buffer provides. At smaller buffer sizes, the chances of Z-fighting is higher as a consequence.

3. Provide a "copy constructor" that initializes an sf::Vector3 from an sf::Vector2 and sets the z coordinate to 0. For the performance freaks like me, this can be even done using a move when applicable.

4. Like I said in my previous post, make it optional so that the people who have a clue what they are doing can solve this problem on their own. If you want to use the depth buffer, you will have to make semantic changes to your application to deal with this problem and it isn't the responsibility of SFML to make sure the values that are specified are sane. Garbage In Garbage Out.

5. Same argument as 4. People have to give it a bit more thought instead of just doing sf::enableDepth( true ) and expecting the application to behave like what they had in mind instantly from the beginning. SFML is a mid-level API and shouldn't try to do too much thinking for the user. They should also have a bit of code to solve their specific problems.
Title: Re: Z ordering
Post by: Laurent on April 17, 2013, 12:55:55 pm
Quote
1. Provide something like sf::isDepthBufferAvailable() or something similar to how you check for shader support.
It will be like sf::RenderTexture: the (crappy Intel) driver says it can handle it, but you just see garbage on your screen ;)
But ok, let's say that this point won't cause any problem.

Quote
2. If the depth buffer is disabled in the sf::ContextSettings, just don't enable depth testing. Nothing will happen with the third coordinate then, if you are using an orthographic projection.
That's what I'd like to avoid. By changing an indirect property, which is normally only for your own OpenGL rendering, you disable a major feature of SFML.
But, again, let's say it's ok...

Quote
Your conception of the depth buffer precision is also not correct.
I know Z values are not mapped uniformly, but with 8 bits the number of available Z values will be ridiculously low anyway, regardless how they are mapped to those 8 bits (ok, I shouldn't have said "256").

Quote
3. Provide a "copy constructor" that initializes an sf::Vector3 from an sf::Vector2 and sets the z coordinate to 0.
I don't like this kind of implicit conversions. And making it explicit won't be less verbose than the regular constructor.

Quote
4. Like I said in my previous post, make it optional so that the people who have a clue what they are doing can solve this problem on their own. If you want to use the depth buffer, you will have to make semantic changes to your application to deal with this problem and it isn't the responsibility of SFML to make sure the values that are specified are sane. Garbage In Garbage Out.
I'd like to make depth testing optional, but implicitly: assign a depth value or leave the default one if you don't care. Any solution that makes activation of depth testing explicit is already too bloated.
At this point I'd like to see proposals for a clean and simple API. Otherwise I'll hardly be convinced ;)

Quote
5. Same argument as 4. People have to give it a bit more thought instead of just doing sf::enableDepth( true ) and expecting the application to behave like what they had in mind instantly from the beginning.
This is not my philosophy. I'd like things to work out of the box, in all cases, and as expected as soon as you activate them. If users need to figure out a specific context with certain conditions to have it working as expected, it's already too complicated. Especially for this feature, which is really basic and simple (as opposed to shaders, for example).
SFML would just be FML if I just implemented a thin wrapper on top of OpenGL without dealing with the annoying rendering issues.
Title: Re: Z ordering
Post by: binary1248 on April 17, 2013, 04:55:03 pm
This is not my philosophy. I'd like things to work out of the box, in all cases, and as expected as soon as you activate them. If users need to figure out a specific context with certain conditions to have it working as expected, it's already too complicated. Especially for this feature, which is really basic and simple (as opposed to shaders, for example).
SFML would just be FML if I just implemented a thin wrapper on top of OpenGL without dealing with the annoying rendering issues.
Well, good luck then. Depth testing wasn't around from the start of computer graphics and can be considered an "advanced" technique. That being said, I don't see any way to provide transparent support for depth testing without jumping through loops.

As an example, initially, I wanted to optimize the new SFGUI renderer to make use of depth testing because of the high levels of overdraw that was occurring. This meant that I had to create a workaround for transparent GUI themes because the blending got messed up. So I detected whether any blending had to be performed (by explicitly checking for an alpha value < 255 or > 0) and disabled depth testing for the whole process if even one primitive had to be rendered with blending. The fun part really started there... I noticed somehow the fonts started looking weird. After browsing through SFML code I noticed that the font textures needed to be blended into the background because that's the way you implemented it with FreeType smoothing activated as opposed to simple masking. After tens of hours of trying to work around that I just gave up and disabled depth testing because it broke too much stuff. There was simply no way to do it transparently because of the nature of the concept. The code is still in the renderer but has been deactivated for a very long time :).

I think that will be the case with SFML as well. If the user does not consciously make use of depth testing there will always be cases where something will get broken. There are probably ways to work around this, but I'm sure you are less interested in spending a significant amount of time on something that could be considered a "little optimisation".
Title: Re: Z ordering
Post by: Laurent on April 17, 2013, 06:07:34 pm
Your experience confirms that enabling depth testing in SFML is probably not a good idea. It feels like it will cause more problems than it solves.
Title: Re: Z ordering
Post by: Tank on April 18, 2013, 08:42:13 am
Quote
Your experience confirms that enabling depth testing in SFML is probably not a good idea. It feels like it will cause more problems than it solves.
I really don't agree with that. I'm doing a really simple game and already have to think about using a custom OpenGL renderer instead of SFML's graphics module because there's no easy way to do my z ordering. As long as I'm in control of everything I can implement my own, but when using external libraries (like Thor's particle system), I'm at a dead end.

The depth buffer is definitely not something I'd recommend for a beginner, that's why it should be disabled by default. But not having the option to enable it makes me feel quite uncomfortable, because it's such an elemental feature of rendering in general.

What about moving the z component to a new render state?

window.draw( stuff, sf::Depth( 1234.0f ) );

SFML could enable depth testing when it detects such a state automagically, thus removing the explicit part of it.

Regarding the "What if the user chooses 8 bpps?": Your own fault. It's like being surprised that colors look wonky when setting a low color depth.
Title: Re: Z ordering
Post by: foobarbaz on April 18, 2013, 11:00:09 am
Probably a bit late to the party, but I'd definitely be interested in this feature. In my game engine, I handle it with this code:


void Scene::render(sf::RenderTarget *target, sf::RenderStates states)
{
    int topLayer = 0;
    for (unsigned int o = 0; o < mGameObjects.size(); o++)
        topLayer = std::max(topLayer, mGameObjects[o]->getRenderLayer());


    for (int l = 0; l <= topLayer; l++)
    {
        for (unsigned int o = 0; o < mGameObjects.size(); o++)
        {
            if (mGameObjects[o]->getRenderLayer() == l)
                mGameObjects[o]->onRender(target, states);
        }
    }
}
 


But if there's some legendary, mega-fast OpenGL depth buffer then that sounds awesome!

EDIT: I agree with Tank, the particle systems example hits home for me. I haven't even started thinking about particles yet, but I'll have to do my own custom particle engine to make the depth work with my game engine's render layers.

Double edit: Although, I suppose I could just call the render function for whatever external library wherever I want, so maybe it isn't such an issue.
Title: Re: Z ordering
Post by: Tank on April 18, 2013, 11:35:21 am
Quote
Although, I suppose I could just call the render function for whatever external library wherever I want, so maybe it isn't such an issue.
If particles stay in one specific layer, then it's not a problem. But just imagine smoke particles that go up in a top-down game. They might start below other objects, but after some time occlude them due to moving up.

Or the problem I currently face: You look along the z axis and simulate sprite depth by scaling them. Sprites need to be ordered so they occlude what's behind them, and the same applies to particles: If an object explodes at z=10, the explosion effect particles have to occlude stuff with z<10 and be occluded by objects with z>10.

It's impossible to do except you implement your own particle system that does z ordering. Considering that Thor already provides a nice particle system, I find it an unacceptable solution (rather a workaround for something that should probably be supported out of the box, because the underlying graphics backend supports it).
Title: Re: Z ordering
Post by: foobarbaz on April 18, 2013, 11:52:25 am
Quote
Although, I suppose I could just call the render function for whatever external library wherever I want, so maybe it isn't such an issue.
If particles stay in one specific layer, then it's not a problem. But just imagine smoke particles that go up in a top-down game. They might start below other objects, but after some time occlude them due to moving up.

Or the problem I currently face: You look along the z axis and simulate sprite depth by scaling them. Sprites need to be ordered so they occlude what's behind them, and the same applies to particles: If an object explodes at z=10, the explosion effect particles have to occlude stuff with z<10 and be occluded by objects with z>10.

It's impossible to do except you implement your own particle system that does z ordering. Considering that Thor already provides a nice particle system, I find it an unacceptable solution (rather a workaround for something that should probably be supported out of the box, because the underlying graphics backend supports it).

Touché.
Title: Re: Z ordering
Post by: MorleyDev on April 18, 2013, 02:47:49 pm
Possibly one of my only real design criticism of SFML: It doesn't it lend itself well to replacing internal implementations without...well, rewriting the internal implementations more or less completely.

If it was possible for the underlying code to swap out the rendering system of SFML on the fly you could just replace the "unordered OpenGL Renderer" with a "Depth-Buffered OpenGL renderer" or "Sorting OpenGL renderer" as needs be. Having to have a bunch of if statements related to this kind of thing is a bit of a code smell. It's also why a DirectX port of SFML would be incredibly difficult.

But maybe this is just the different way I code. I also regard functions larger than 5 lines as "too big" and classes that need a bunch of private functions to do it's job as "having too many responsibilities".
Title: Re: Z ordering
Post by: Laurent on April 18, 2013, 03:10:16 pm
I disagree. In my opinion SFML has a rather clean internal design, and writing a different back-end would be easy.

The problem with this feature is that it must be part of the public API. All the issues discussed here are about the API changes, not the implementation details.
Title: Re: Z ordering
Post by: Tank on April 18, 2013, 03:47:39 pm
Quote
In my opinion SFML has a rather clean internal design, and writing a different back-end would be easy.
It is indeed very clean, but MorleyDev is also right that several modules of SFML are not exchangable.

Quote
All the issues discussed here are about the API changes, not the implementation details.
What about the render state?
Title: Re: Z ordering
Post by: Laurent on April 18, 2013, 04:00:34 pm
Quote
What about the render state?
?
Title: Re: Z ordering
Post by: Tank on April 18, 2013, 04:16:25 pm
I think you missed reply #10.
Title: Re: Z ordering
Post by: Laurent on April 18, 2013, 04:31:28 pm
Quote
I think you missed reply #10.
This is also about the public API. When I say "implementation details" I mean the corresponding OpenGL code -- which will probably be straight-forward.
Title: Re: Z ordering
Post by: binary1248 on April 18, 2013, 07:08:36 pm
I think the main problem here is the definition of "simple" that people might have. For me, something that is simple is merely something that is easy to learn and understand if you want to. This concerns getting the things done that you want to get done. So if you do not understand how to achieve something with SFML, a quick look up in the documentation should get you up and running in minimal time.

If you compare SFML to other libraries out there then yes, SFML is simple but that is mainly because it does not force you to do things that shouldn't be your concern. As an example, if you want to draw a simple triangle in SFML, you would need to write <30 lines of code, whereas if you wanted to do the same using DirectX and Win32 you would end up with >200 lines of code. This is what the difference between "simple" and "complex" is for me.

If you add depth functionality to SFML it will still stay simple, even if you expose more details to the user because they can opt not to make use of it if they want and SFML won't bother them with unnecessary details. This would make SFML more powerful while still keeping it simple and easy for newcomers to learn. I regret to say, but you are sacrificing the power and flexibility that such a library could provide to those that need it in favour of protecting beginners from a longer list of methods that they might potentially not even need. This is a wrong decision if you ask me, because it deters more "serious" users to go use other libraries or write their own code on top of SFML to get things done which reduces productivity.

SFML has great potential and might even overtake many other libraries out there if you can provide more advanced functionality while keeping to the same principles that you have so far. Just like good computer games, it should be easy to learn and hard to master.

I have another proposal, perhaps SFML can adopt a similar model to what C++ uses regarding its standard library. People can propose extensions that are implemented using the core SFML functionality much like boost is the staging ground for possible inclusions into C++. If you consider the quality to be up to your standards and the extension is widely accepted and used among the community then you can think about adopting and merging it into core SFML. This would make the SFML development and evolution process unique among libraries of its kind and the rationale behind the features in it based on real-world experience as opposed to theoretical/ideological usage concerns.

What do the others think?
Title: Re: Z ordering
Post by: MorleyDev on April 18, 2013, 07:40:05 pm
I disagree. In my opinion SFML has a rather clean internal design, and writing a different back-end would be easy.

In general it's a very clean from a high-level point of view.

Perhaps an example of what I mean is needed. See RenderTarget::draw (https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/RenderTarget.cpp). Personally I find this function just has way too much going on in it, the RenderTarget class and that function are directly responsible for too many things.

To talk in terms, it breaks Single responsibility (http://en.wikipedia.org/wiki/Single_responsibility_principle).

From a big design point of view the interface is very nice, the underlying code isn't a sphagetti-like mess, many if statements but the nesting is shallow and they end quickly. It is very easy to understand and modify, but it's not without problems. As I said I favour small functions with very tight focus, and that does not (from my point of view) describe that draw function or some other parts of SFML that have just built up a lot of mass to accomplish their many responsibilities.

Of course this may just be a result of them not being refactored and cleaned up in awhile. Bit rot takes it's toll on us all.
Title: Re: Z ordering
Post by: Tank on April 18, 2013, 08:29:21 pm
tl;dr
What do the others think?
I fully agree on every single line. Jesus, this is rare, but I really agree to what you said. ;)

However, whilst SFML in itself is greatly designed, it's not best suited for writing extensions in some areas. I guess the reason for that is the simplicity this library was and still is targeted at. E.g. you never have to instantiate a renderer and you mostly don't have to deal with technical details. SFML is, even if often stated otherwise, quite high-level with not sooo much room to be extensible -- at least not without touching the original code.

I, and most likely others, including binary1248, too, would have written some extensions for SFML already if it was easy or even possible to do so. Just like this z ordering discussion. The problem is that I can't really do it myself without patching SFML, while having in mind that my patch probably will never be accepted because the library's author has another philosophy.

Like binary1248 I'm also convinced that SFML could be a lot better regarding acceptance in the "more serious" field by enabling the user to use or attach advanced features and techniques. But without that possibility I assume that many won't consider using SFML for projects because of its limited scope. I already said it a million times already, but I'm seriously considering writing my own OpenGL rendering code (again *sigh*) for the _small_ game I'm making because I've already hit the boundaries of SFML that I can't workaround without patching it.

Of course making SFML's modules more exchangeable isn't a step you can do in some days or even weeks, and something like this has to be planned carefully. But if you asked me, I'd love to see SFML's future in a collection of core and extension modules. One might argue that SFML already is just that, but that's not quite true. Even if the modules are separated, and if some of them can be dropped if not used/needed, they still form a whole in themselves.

So, +1 for an SFML App Store. :P
Title: Re: Z ordering
Post by: Nexus on April 18, 2013, 08:51:16 pm
What do the others think?
It sounds interesting. I recently had a discussion about why a lot of professional indie games build their own engine from scratch, instead of resuing at least partially existing open-source libraries like SFML, Irrlicht or Ogre. Apart from religious reasons and the limited spread, one point was that although these libraries allow very quick development, specific features would be difficult to integrate, and people would always end up patching other libraries (which allegedly takes more time than rewriting everything). Nevertheless, it was certainly not the only reason.

On the other hand, I don't see that more low-level functionality necessarily improves the library. It is always a trade-off between abstraction and flexibility. And you can never achieve everything you could when using directly the underlying libraries, so it's just a question of where to draw the border. The k.o. criterion would be the utility of a new feature vs. its complexity in API and implementation.

Anyway, you can already now fork SFML and try to integrate your own features -- it would be a good way to show what ann implementation might look like, and over time the functionality would be improved with respect to code clarity, bugs and performance. This approach does not steal Laurent's rare free time, and with a working and clean implementation, it might be easier to convince him ;)
Title: Re: Z ordering
Post by: Tank on April 18, 2013, 08:55:10 pm
Quote
Anyway, you can already now fork SFML and try to integrate your own features -- it would be a good way to show what ann implementation might look like, and over time the functionality would be improved with respect to code clarity, bugs and performance.
Yes, it can be forked. But to be honest I'd rather contribute to the original source. The risk of patches not being accepted, especially with this project and its philosophies, is quite high, and I don't want to live with a patched library not written by myself. It's what the people say you asked: It's often easier to reinvent the wheel yourself to implement the things you need than taking an existing library, having to learn and patch it.
Title: Re: Z ordering
Post by: Laurent on April 18, 2013, 10:01:11 pm
My best members are having a passionate discussion about philosophy and design choices. I really love that :P

My first answer was "I'm not against this feature", and it's still true. The problem is that there are obvious design issues to solve, so when I say "I'm not convinced" you should understand "wait after SFML 2.0 is released so that I have time to experiment the idea", not "I won't do it".

Make SFML more extensible/flexible to allow add-ons... it's already the philosophy. I changed the graphics API to provide a single low-level entry point for rendering (vertex array + render states), base classes that allow to reuse common code/interfaces in any class, and now all higher-level classes are built on top of that and anybody can provide its own graphical class which would be at the same level as SFML built-in classes. That was already an important step (remember, in SFML 1.6 every graphical class had direct OpenGL calls in it).

But providing enough flexibility so that you can add the Z-buffer feature without touching SFML, seems like impossible to me. It requires to add a Z component to the lowest-level possible graphical entities, to adapt the context creation code to force a Z-buffer, and to manage additional OpenGL states. It's a core feature and I don't know what kind of design SFML could have to allow that as an external add-on.

But yes, of course I agree with this philosophy, and I'll try to take this direction whenever I can.
Title: Re: Z ordering
Post by: MorleyDev on April 18, 2013, 11:02:58 pm
The best way I can think of is if your render target is split down into a series of components that determine how rendering takes place. So if you disable alpha blending, the alpha blending rendering component isn't present. If you want the Depth Buffer, replace the parts of the render target that it needs to in order to allow for depth buffering. Basically render-target would no longer contain any OpenGL calls, it's dependencies would handle all of that so all you need to do is swap out those dependencies.

In theory this also means you could have an implementation that, when the depth buffer is missing, fakes one in code by buffering render calls until the very last second...

It'd require a pretty big refactor of the draw code before even beginning. I mean, it'd be incredibly flexible but a lot of effort would have to go into it.
Title: Re: Z ordering
Post by: Laurent on April 18, 2013, 11:07:45 pm
That would work in a perfect world. In the real world, things are never completely independant. Especially when you start to implement optimizations. The context handling of OpenGL, which is tightly linked to the windowing system and OS dependant, makes it even harder (to have a depth buffer you need to modify this part too). It doesn't even belong to the same SFML module.

And don't forget that SFML will soon switch to a shader-only implementation (GL 2 architecture). Which makes it easy to customize the rendering, you just have to provide your own shader, but it becomes impossible to combine several pre-defined rendering features together at runtime.
Title: Re: Z ordering
Post by: MorleyDev on April 18, 2013, 11:37:26 pm
Ah, the requirements at Window creation managed to completely split my mind...yeah, that does make things even more complicated...although in theory dependency injection would still be very doable there since it means you're just swapping out the dependencies of RenderTarget depending upon whether or not the depth buffer is there. But still more complicated especially given the current approach where classes manage their own creation instead of a factory pattern.

But then when you throw the shader-only implementation...hmm, very interesting. I thought they didn't properly deprecate the state system until OpenGL 3.0? Still, shader-only is always good. New challenges brought by that, but good.
Title: Re: Z ordering
Post by: Laurent on April 19, 2013, 07:58:36 am
Quote
I thought they didn't properly deprecate the state system until OpenGL 3.0?
True, in fact the platform which has the most constraints is OpenGL ES 2 (mobile devices), which has no fixed pipeline.