Haxe3D C++ Demo.

Nicolas Cannasse has written a 3D engine for flash 10. I have ported this code to neko and c++ using the neash library.


To test the code, first extract the contents of the zip and then look in the bin directory. Double click the h3d.exe or h3d_ogl.bat files to run the c++ version (the h3d\_ogl.bat uses opengl, the other version uses the software renderer). You can see the flash version from the .html file (note: you will need flash player 10). You can run the neko if you have the haxelib version of nme installed by running “neko h3d.n”. All the source files are there in case you want to do some mods.

I have changed the mouse-look scheme from the original code to keep things a bit more centred. Move the mouse left/right to spin the objects, move it up/down to raise or lower the camera. You can use ‘w’ key for wireframe and the ‘p’ key for shading effects.

On my faster computer, I get about 100fps for the opengl renderer, 80fps for the software renderer, 40fps for the flash10 renderer, and 1fps for the neko/software renderer. There are some optimisations that could be done for the neash API, but really significant improvements could be gained by moving some of the engine into c++ code.

Currently, it is windows only. You can get it here.


There were reports of preformance loss in opengl, and I think I may have traced it to excessive texture transactions due to the text in the status panel. To work around this, I have cached the text as glyph bitmaps (doing this was on my todo list) which seems to have helped. (This update is in the svn version of neash). I have also added a command-line switch to use a simple fps counter instead of the status panel. You can try this out with the h3d\_ogl\_simple.bat command, In the new download.

5 Replies to “Haxe3D C++ Demo.”

  1. On my Core 2 6400 I get ~50 FPS with OpenGL (with small lags 2-3 time per seconds) and a very smooth ~80 FPS using software renderer.

    Both are faster than ~40 FPS Flash, but Flash looks better thanks to antialiasing.

    BTW French keyboard does not work well, since “Z” key produces “W” instead.

  2. I also got a stutter in the opengl mode on my older card (geforce 5200). The usage pattern does not really suit opengl – transferring the data to the GPU every frame. Maybe a texture is getting thrashed and the AGP bus is just not up for it. (Does it coincide with the stats graph getting updated? – I will have to check)
    And maybe I should also multi-thread the software renderer (this should be reasonably easy).
    Interesting point on the keyboard.

  3. Awesome!

    Have you considered having iPhone as a build target as well? I’m pretty certain that only a little bit of Objective-C would need to be written to achieve this.

    Either way, this is a fantastic project. Thanks for releasing it for us all to use!

    1. I have thought about iphone – there are a few issues that need to be sorted – especially for non-jail broken phones.
      1. iPhone does not allow dso I think. This means that even if there was a SDL port, it may end up making the final app GPL, which is a bit sad.
      I think it would not be toooo hard to write a freeware (as in free) library specifically for the iphone that supports the SDL functions required by NME.
      It would also require a minor adjustment in the way modules are loaded – not a showstopper though.
      2. It supports OpenGL ES, not OpenGL. I don’t think this would be too hard to work around.
      3. iPhone and garbage collection is a grey area. I think that it still may be possible in one form or another.

      There has been quite a bit of interest with other homebrew consoles – most of which have an SDL port so the scope of this may well expand in the near future.

Leave a Reply

Your email address will not be published. Required fields are marked *