NME 5.0 - mixing 2D with 3D

150 views
Skip to first unread message

Vujadin Krtolica

unread,
Mar 11, 2014, 3:03:39 PM3/11/14
to haxe...@googlegroups.com
Is it possible to put 2D content (NME display list) on top of 3D scene in new NME ?

this is easily achieved with OpenFL but it drastically affects performance on CPP targets.

first tests are showing lower CPU usage with NME in 3D :) , but my 2D/3D mix examples don't work with NME

Hugh

unread,
Mar 12, 2014, 12:44:11 AM3/12/14
to haxe...@googlegroups.com

I have had it working quite well.

See:

https://github.com/nmehost/nme/blob/master/samples/HerokuShaders/Source/Main.hx

Where it uses "addChild" to add a FPS counter.

My guess is that some state is not being restored - like scissor box, depth test etc.  The current version does not restore everything automatically. But it will set some things like current program, vertex attribs and textures, so your program will need to set a few things up each render and not assume the state is persistent.  I am thinking about the state management - if it is not restored then it would be possible to use 2 ogl views to sandwich a 2d call and set some interesting states.

I noticed the sample used to do a glClear.  NME does a clear every frame, so if you do another you could wipe the existing drawings.  To make the gui come over the top, make sure you "addChild" it later on the display list.  There should be little or no slowdown (apart from the sum of the two render times)

Hugh

Vujadin Krtolica

unread,
Mar 12, 2014, 4:06:36 PM3/12/14
to haxe...@googlegroups.com
Hi,

yes - works perfectly ! NME version was set to some very old dev version so after deleting and reinstaling NME it works, 
and no slowdowns, performance is much better than with OpenFL - I've switched BabylonHx to NME and it works perfectly !

I wanted to test it on android but I couldn't build:

C:\Program Files (x86)\HaxeFoundation\haxe\lib\hxcpp\3,1,21//include/hxcpp.h:14:20: fatal error: typeinfo: No such file or directory

maybe I have to reconfigure something or to update android NDK ?

Joshua Granick

unread,
Mar 12, 2014, 6:16:08 PM3/12/14
to haxe...@googlegroups.com
Which version of OpenFL were you testing against?

The recent OpenFL release should be virtually identical to NME in these regards, so I'm not sure what would make a performance difference.

Thanks!
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.



--
Using Opera's mail client: http://www.opera.com/mail/

Hugh

unread,
Mar 12, 2014, 9:20:48 PM3/12/14
to haxe...@googlegroups.com


If you run with the "-v" flag, you should get more info about with SDK/NDK is being used.

I recommend using the latest one - maybe you have an old setting in your .hxcpp_config.xml

Hugh

Vujadin Krtolica

unread,
Mar 13, 2014, 3:13:41 PM3/13/14
to haxe...@googlegroups.com
I've removed old hxcpp_config.xml and reinstaled hxcpp, so now android build works. Thanks Hugh.

Regarding OpenFL, I'm using the latest version of Lime/OpenFL. Here's a screenshot of BabylonHx built both for NME and OpenFL, you can see the difference in CPU/Mem usage in taskmanager:

Reply all
Reply to author
Forward
0 new messages