
The OpenTK Framework
Posted Sunday, 14 December, 2008 - 02:26 by flopoloco inI would be interested to start working on an application framework called OpenTK Framework that will allow users to create games/simulations/graphics extremely fast and easy. This OpenTK Framework will wrap common functionality in order to provide a layer of abstractness to the user when programming 3D. Because it will be easy to use, thus it will enhance creativity and productivity.
By using the OpenTK Framework each developer can focus in the field he is really interested in:
* A physics developer can simulate his fluid dynamics without paying attention to his graphics code at all!!!
* A network developer can visualize the packets and network traffic with remarkable easiness.
* A game developer can focus on the game play mechanics (making even better and enjoyable games) rather focusing on the WOW factor
(NOTE: OpenTK Framework will be WOW-factor compatible, as long as there are good shaders loaded in it)
A use case scenario follows (outdated - a more Object Oriented API will implemented) :
// How to create a romantic moonlight scene with the exact parts (boat, sea, sky, stars and moon) using System; using OpenTK; using OpenTK.Input; using OpenTKFramework; namespace OpenTKFrameworkGameTest { class Game : GameWindow { Entity camera, moon, ship, skybox, sea; Entity [] star = new Entity[100]; public Game() { // Create a skybox Entity skybox = CreateBox(); EntityScale(skybox , 100, 100, 100); EntityFlip(skybox); // Flip normals EntityTexture(skybox, "media/textures/nightsky.jpg"); // Create a camera Entity camera = CreateCamera(); EntityParent(camera, skybox, ParentingRelation.Positional); // skybox will be the child node of camera in positional manners. EntityPosition(camera, 500, 10, 200); EntityRotate(camera, -40, 0, 0); // sky box is not rotated EntityColor(camera, 0, 0, 0); // Set the clearing color of screen EntityShader(camera, "media/shaders/bloomfilter.glsl"); EntityShader(camera, "media/shaders/hdrfilter.glsl"); // Post production filters can be combined // Create the moon Entity moon = CreateSphere(); EntityPosition(moon, 200, 600, 200); EntityScale(moon, 10, 10, 10); EntityTexture(moon, "media/textures/moon.jpg"); EntityShader(moon, ShadingStyle.Flat); // Use some of the already existing basic shaders. // Create a ship ship = LoadModel("media/models/ship/ship.x"); EntityTexture(ship, "media/models/ship/ship.dds"); // Create stars for (int i = 0; i <= 99; i++) { star[i] = CreateSphere(); EntityPosition(star[i], Random(-500.0, 500.0), 800.0, Random(-500.0, 500.0)); byte starColor = Random(0, 255); EntityColor(star[i], starColor, starColor, starColor); } // Create sea sea = CreatePlane(); EntityRotation(sea, 90, 0, 0); EntityScale(sea, 1000, 0, 1000); EntityShader(sea , "media/shaders/realistic_water.glsl"); } // Give simple movement to the ship public override void OnUpdateFrame(UpdateFrameEventArgs e) { base.OnUpdateFrame(e); if (Keyboard[Key.Up]) EntityTranslate(ship, 0, 0, 1); if (Keyboard[Key.Down]) EntityTranslate(ship, 0, 0, -1); if (Keyboard[Key.Left]) EntityRotate(ship, 0, -1, 0); if (Keyboard[Key.Right]) EntityRotate(ship, 0, 1, 0); if (Keyboard[Key.Escape]) Exit(); } public static void Main(string[] args) { Game game = new Game(); game.Run(30.0); } } }
That was 100% C# and 100% OpenToolkit!!! Isn't that great?


Comments
Re: The OpenTK Framework
I have started working again for a couple of 10 days on the project... Here is a basic part of the Entity class, that will make your game transformations piece of cake!!! :)
Also there's an accompanying standalone example application of the class:
As for the progress of the OpenTK Framework, I will continue the work in my own pace (that means really slow) and provide source code of the 5 most important classes of it :
- Mesh Loaders (Collada, 3Ds, Obj)
- Camera
- Materials
- Shaders
- Lights
Remember: OpenTK Framework is about higher level access and ease of use...
Re: The OpenTK Framework
Do you have a particular game in mind?
Re: The OpenTK Framework
This would be nicer and more C# than C++ :
Re: The OpenTK Framework
objarni: No, I have not a specific game in mind. But I would like to experiment on new genres, that means I would like plenty of functionality for start.
iliak: Thanks for your notice. When I get some basic parts working I would pay more attention to C# specifications (also I think of integrating FXCop, StyleCop and Test Driven Development into it, any one has experience with these?).