Archives

I’m working on a small TechDemo to show-off what I can in programming for internship purposes.

The TechDemo will use Ogre for rendering, but at an abstract way.

I made a class called EngineGraphicsLayer, which defines some virtual functions including DrawMesh, DrawTexture, CreateMesh and CreateTexture.

I then made a few abstract classes called EngineGraphicsMesh and EngineGraphicsTexture, which are implemented with render specific data too.

So for Ogre I’ve created a OgreGraphicsLayer, OgreGraphicsMesh and OgreGraphicsTexture which all three call their Ogre functions, but this makes it possible to just remove Ogre from the demo and use OpenGL or DirectX. The formats used aren’t ogre specific too, hence I created my own formats called pxa and px.

The pxa is the text version of the px format, which both can contain anything from maps to meshes. (its more an extendable format designed for the demo).

So now, I can just remove Ogre later on and switch to OpenGL/DirectX without the need to change anything else then the GraphicsLayer!

I’ve been looking a bit into OpenGL and DirectX to see which of both is more usable and easier to learn.

I first choose OpenGL to be the winner on this field because of its not-object-orientated design, but soon found out I was wrong. Few points that I initially saw:

OpenGL is much easier to initialize then DirectX and easier to use because of its no need to use vertex arrays.

For 2D view the camera system is really easy to setup.

But then I realized that I’m a C++ programmer, so object-orientated design is probably better to use. So I looked into DirectX. DirectX seems to handle it much different then OpenGL, you need to create a “root” class and from there create a “device” class per DirectX device you are willing to use. This is pretty easy to use for basic setup, so I just used default parameters with my own HWND. It immediately setup alot of stuff like clear color (which I want to default to black anyway) and camera position. No more positioning the camera at -screenwidth and -screenheight to get 0,0 of the screen at 0,0 of the world. (2d view). One more advantage of DirectX over OpenGL is that it doesn’t use the extensions stuff opengl uses. DirectX has fallback methods when calling stuff thats not available, so it will always work. (The speed is another point).

Even though OpenGL is cross-platform, it does have the regular driver issues that directx doesn’t seem to have.

I’m now more in for DirectX, but if someone has some point I’ve missed, don’t hesitate to speak up!

Long time no posting basically because I didn’t have anything to post!

But, lately I’ve been looking into the Google Android platform to see if it would be possible to port Ogre over.

I soon found out this wasn’t possible since the C++ runtime of android doesn’t support exceptions or RTTI. (exceptions are dependant on RTTI anyway).

So I started to look into how it could be possible, I found out that you could port over newlib as libc (instead of using the android libc) and use the regular libstdc++ then. First you need to compile the compiler so that it could even compile exceptions. So I did that (gcc 4.4.2 compiled as target = arm-none-eabi) and then I started porting over newlib. Since libc from android already defines the syscalls it wasn’t very hard, and with newlib compiled I could compile libstdc++! So I now have a fully featured android compiler with exceptions and RTTI! The only problem is that androids build system is kinda weird, so I’ll have to try to adapt my compiled toolchain to their system so that I can compile android applications to test it out. (I have no idea if its even working at this moment).

If anyone has some suggestions why this can or can’t work, or how to make it adapt to the android build system then please leave a comment. 🙂