Shaders and Framebuffers
Well, HLSL is no longer supported. At least, writing your own custom HLSL shaders isn't supported. The reason is it is too difficult to create an API that can be supported by OpenGL as well as Direct3D, especially considering the miserable support for OpenGL 3 outside of nVidia and ATI on Windows and Linux. Instead, shader support has been redesigned to use built-in shaders, which may or may not be implemented with fixed functionality. This allows for OpenGL and Direct3D to have the same level of support in AgateLib, and also cleans up considerably AgateLib internals. Now one can select a shader from the AgateLib.DisplayLib.Shaders.AgateBuiltInShaders class. At the moment, only basic 2D and 3D shaders are available, but these will be expanded on in the future.
Also, the way in which render targets are used has been redesigned. Gone is the lame IRenderTarget interface, instead we have FrameBuffer objects. DisplayWindows now have their own FrameBuffer field that can be used when setting Display.RenderTarget. To render to a surface, you use code like
- FrameBuffer buffer = new FrameBuffer();
- Display.RenderTarget = buffer;
- // do stuff
- // okay, now we can use the rendered surface
- Surface mysurf = buffer.BackBuffer;
Overall, this is a minor change to AgateLib consumer code, but it has allowed considerable clean up of the AgateLib implementations, and it will be much more flexible in supporting any future features that might be useful, like multisampling.