Post permalink

@sysrpl: I disagree. Although what we disagree about here is the confusion level rather than the definitions themselves so it's kindof a meta-disagreement

Of course without surveying every Silverlight developer it's a bit hard to say what they would interpret 'immediate' and 'retained' to mean, but here's a simple definition that applies to any graphics API including OpenGL/DirectX and Silverlight/WPF and even Win32:-

Immediate - Every time the screen (or part thereof) is to be redrawn, your program must call API functions to make that happen.

Retained - Your program provides data to the API and then the system redraws the screen as necessary without further involvement of your program until you decide that you want something different to be displayed.

Following these definitions OpenGL, DirectX and XNA are strictly immediate whether you use index buffers or individual primite draw calls (although DirectX did have a retained mode back in the DX3 days it was dropped a long time ago). Win32 is also an immediate mode API if you think about it - you get a WM_PAINT message, but it's still your code that's redrawing the screen.

Silverlight is at the moment strictly a retained mode API. You have to create instances of objects that derive from the UIElement class and attach them to the visual tree in order to make anything happen on screen. Once you've done so your program has no more involvement in drawing the window regardless of how many times it needs to be repained by the windowing system. In fact Silverlight goes even further and takes animation out of your hands, making that a retained behaviour.

WPF you could look at either way. It has the same retained visual tree objects as Silverlight, but you can also draw in an immediate style by overriding the OnRender method of the UIElement class. However, the functions you call on the DrawingContext don't actually result in something being drawn on-screen at that point in time, instead a datastructure is created behind the scenes which is used behind the scenes to paint the window when WPF decides it needs doing and that is retained until the next call to OnRender is forced. So WPF is also strictly a retained mode API, although it can be programmed in an immediate style.