Posts Tagged ‘engine’

Bridging the Gap with C++/CLI

January 28th, 2016 No comments

A bit more than a week on and I’ve made some good progress on my project. I’ve spend a bit less time on adding things which while unfortunately does mean the screenshot in my last post is more or less unchanged but there’s been a number of changes behind the scenes.

  • The project has been split into three parts:
    • The engine DLL
    • An engine ‘runner’ / test application
    • Unit test project

This isn’t overly significant but provides a stable foundation for me to work with. One project is dedicated to all engine features and development, one for testing it, adding various custom binds and what not, and finally a unit test project that’ll ensure components of the engine remain in a working order.

Unit tests aren’t new to me but I haven’t actually used them before in C++. There isn’t much difference in implementation since Microsoft’s Unit Test Framework is solid and built right into Visual Studio.

Something that is entirely new to me however is C++/CLI. What I’ve been interested in doing for some time now is to develop a user interface with the engine running inside it as a small sub-region. This could be used for example, to create a level editor. C# .NET is excellent for developing user interfaces, however the engine is written in C++ language. There is the option of using COM Interop, but not only is this potentially slow, it’s also making things overly complicated.


A C++/CLI project is essentially Managed C++, capable of interacting with both native C++ and managed code, making it ideal for creating a bridging interface between the engine and any potential C# applications.

So far I’ve ‘ported’ most of the engine’s API calls over and am able to almost entirely replicate the image in my last post with a few small exceptions (primarily the second image) as I’m investigating an issue with vertex buffers and/or transforms (an interesting combination, no?)

I’ve also looked into designing a VSIX project which would basically allow me to create a WPF or Winforms ‘Toolbox Control’ so I can drag and drop an ‘Engine component’ onto a form and have it load. Unfortunately after an uneventful night this proved unsuccessful possibly due to the native library dependencies involved.

Fortunately I’ve had better luck simply hooking the engine up to the window handle of a WinForms component. As WPF only uses a single window handle for the main window, I’ve used a WindowsFormsHost component to still allow the flexibility of WPF while allowing me to hook up to a handle for this result (UI design not final ☺!):


Categories: Me, Programming Tags: , ,


December 19th, 2008 No comments

Ogre was increasingly difficult for me to manage, so once again I had moved engines. It’s always a good idea to stick with something, but for someone who has not had extensive knowledge previously in programming, Ogre was not the best way to do things.

So I moved to Irrlicht. Irrlicht seems quite similar to Ogre3D. It uses some similar features which helps with the migration to the new engine, but it is a lot easier to manage. No external plug-ins are required for most basic actions, and it is more than just a rendering engine with all of the features included. It is no way actually better than Ogre, and it may even have some slightly outdated features, but what I’m really enjoyin so far is the ease of use of it. It’s not a “click this and let the program do it for you” engine as it still gives you direct control over everything you do, and then there’s always the additional plug-ins I can include such as PhysX, FMOD, and so on.

I’ve been mostly just playing around in Irrlicht and finishing the tutorials. I tried to combine some of the features in the tutorials and have come up with a nice little demo that I’ve actually spent some time on. The difference between the demo I use and the original tutorial I based it off is that it allows the user to move around while using collision detection on the walls and further user control on the parallax mapping involved in the scene. There are a few smaller features available which can just be seen in the changelog and such.

Download V1.1

It is NOT a game, it is simply show casing these features.

A reasonable graphics card is required for anyone willing to see the full effect of Parallax mapping on the walls, which requires at least Pixel and Vertex Shader 2 on your graphics card. I am running the demo at roughly 1000 frames per second with a 2 year old computer. (A 8800GTS graphics card).

The source file is included for anyone who shares interest in programming, though please don’t ask me how to open a ‘cpp’ file.

Instructions: Extract the contents to any place of your choice and open the example.exe file. Be sure to read the readme.txt, it has some useful information.

Move around with W, A, S and D and the mouse. Use Q, E, Z and C for various scene tweaks. No fancy nuclear weapons yet.