I studied hard the example, generally nothing new to learn here. Just a simple remix, in case some people want to use it as an alternative to their education.
using System;
using DarkGDK;
namespace DarkGDKPostProcessing
{
class Program
{
[STAThread]
private static void Main(string[] args)
{
DarkGDK.Engine.InitializeGDK();
DarkGDK.Camera.CameraEffect.StartShaderSystem(); // Start the shader system
// Create the camera (we use an additional camera, the default camera must remain as is)
DarkGDK.Camera.AdditionalCamera camera = new DarkGDK.Camera.AdditionalCamera();
camera.Position(0f, 0f, -5f);
camera.ColorMyBackdrop(System.Drawing.Color.Black);
// Create an image so camera can render to it
DarkGDK.Basic2D.Image cameraImage = new DarkGDK.Basic2D.Image(8, 8);
// Load the effect and link it to camera and image.
DarkGDK.Camera.CameraEffect cameraEffect = new DarkGDK.Camera.CameraEffect("../../Bloom.dbs");
cameraEffect.Set(camera, cameraImage);
// Create a plane, this plane will use the image generated by camera
DarkGDK.Basic3D.Plane plane = new DarkGDK.Basic3D.Plane(2f, 2f);
// The general idea is that this plane must be positioned in front of the default camera
// This is very easy to happen if we use the Quad shader to the plane
DarkGDK.Basic3D.Effect planeEffect = new DarkGDK.Basic3D.Effect("../../Quad.fx", false);
planeEffect.SetToObject(plane);
// Finally, we can link the plane with the image
plane.TextureStage(0, cameraImage);
// Setup an example scene, just for the demo
DarkGDK.Basic3D.Cube cube = new DarkGDK.Basic3D.Cube(1f);
cube.Color = System.Drawing.Color.Yellow;
while (DarkGDK.Engine.LoopGDK)
{
cube.RotateRelative(1f, 0.4f, 0.2f);
// It's very important to switch the visible state of the plane
// while syncing the camera effect.
plane.Visible = false;
DarkGDK.Camera.CameraEffect.Sync(camera);
plane.Visible = true;
DarkGDK.Core.Sync();
}
}
}
}