I need help creating a simple Delphi-based OpenGL engine. The requirements are:
- The basic principle is that it should be possible to add objects to the scene, and then render the scene as a output image.
- At the moment the only objects I need to add is 32-bit images. The alpha-channel of the images should be used.
- The parameters for each objects should be possible to change before each rendered frame.
- Parameters that I need to be able to set for each object are position (X, Y, Z), rotation (X, Y, Z), opacity (0-100 percent), scale (X, Y, Z).
- It must also be possible at anytime to change the image (with an image with a identical size) without re-creating the object.
- It should also be possible to change camera settings before rendering. At least position (X, Y, Z) and lens angle should be possible to set.
- As manipulation of images are the main thing, there are some things that is important: Images should be handled so that when all paramaters are at default values the image is rendered pixel-by-pixel to the target bitmap. Ie, a image of 100×100 pixels will still be 100×100 pixels when rendered. Unless there is any light added the image should appear identical to the input on the output.
- The ouput render should result in a 32 bitmap image of desired size (up to 1920×1080). It should be the result of all objects with the current properties, and with their alpha channels correctly combined. Render should not be done to screen, only to the image.
- Render should be done on the computers OpenGL graphic card, for fast render of complex scenes.
- Speed is the main focus – all actions has to be optimized for short execution time.
- It should be 100% delphi code, well commented and easy to modify and add functionality to.
- Values for position, scale and rotation should have a meaningful range, where the default is 0 (position and rotation) or 1 (scale).
Here are a pseduo code of how the engine should be used:
A: Init Scene
InitScene();
AddImage(AImage, ObjectID); // AImage = 32bit bitmap
AddImage(AImage, ObjectID); // AImage = 32bit bitmap
B: Render Loop
UpdateImage(ObjectID, NewImage); // New image = 32bit Bitmap
SetImagePosition(ObjectID, XPos, YPos, ZPos);
SetImageScale(ObjectID, XScale, YScale, ZScale);
SetImageOpacity(ObjectID, Opacity);
SetImageRotation(ObjectID, XRotate, YRotate, ZRotate);
SetCameraPosition(XPos, YPos, ZPos);
SetCameraAngle(Angle);
RenderFrame(TargetImage); // TargetImage = 32bit Bitmap
Please provide information on your experience with OpenGL and Delphi with your bid.