Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors with Haxe 3.4.0-rc.2, Lime 3.5.2, hxcpp 3.4.2 #139

Open
dpavicic opened this issue Dec 26, 2016 · 4 comments
Open

Errors with Haxe 3.4.0-rc.2, Lime 3.5.2, hxcpp 3.4.2 #139

dpavicic opened this issue Dec 26, 2016 · 4 comments

Comments

@dpavicic
Copy link

Hey,
I'm trying out Babylon.hx but I got stuck when building the examples ( Lime build ).
First I got lots of missing assets errors but I managed to solve that by downloading them from Babylon.js web and put them into the assets directory.
I tried to build to HTML and Windows native, so here's what happened:

HTML ( Materials test scene )
Assets fail to load, 'engine' reference is undefinged( null )
Build passes fine, no error but when dev server is started, web page is cyan screen and there's lot's of errors in console.
First it says that it cannot read the __renderLoop() function ... it cannot read because at that time 'engine' reference is underfined and it's been called before assets are loaded. From that point assets will never get loaded/displayed.
The 'render' function has been called before assets are loaded and 'onPreloadComplete' callback's been called.
If I put check for engine null reference in ;render' function it works fine. :
override public function render(renderer:Renderer) {
if ( engine == null ) return;
engine._renderLoop();
}
So, this is just a minor issue.

  1. After that fix the scene loads and displays fine but there's a lot WebGL shader related errors in the console and the red semi-transparent sphere acts weirdly when moving around. See screenshot here:
    https://www.dropbox.com/s/izjzaebtl3xgpzq/babylon_html_002.png?dl=0

WINDOWS target
Same issues, red semi-transparent sphere acts weirdly when moving around. So I guess same shader issues applies on hxcpp windows target.

Any thoughts how to deal with those issues?

BTW, Cheers from Croatia

@vujadin
Copy link
Owner

vujadin commented Dec 26, 2016

Hi,
its probably because of 2D stuff as it collides sometimes with 3D depending on complexity of 3D scene, shaders used GL state enabled/disables ets...
2D api is new and still in experimental stage. Its basically a quick and dirty Haxe port of this http://lib.ivank.net/ with some tweaks I've done to make it work with BHx... but it still doesn't work 100%, I just needed basic 2D stuff for a project I worked on.

To disable 2D stuff you need to remove/comment out following lines:
https://github.com/vujadin/BabylonHx/blob/master/src/MainLime.hx#L197
https://github.com/vujadin/BabylonHx/blob/master/src/MainLime.hx#L217

and these too:
https://github.com/vujadin/BabylonHx/blob/master/src/MainLime.hx#L226
https://github.com/vujadin/BabylonHx/blob/master/src/MainLime.hx#L234
https://github.com/vujadin/BabylonHx/blob/master/src/MainLime.hx#L242
https://github.com/vujadin/BabylonHx/blob/master/src/MainLime.hx#L273
https://github.com/vujadin/BabylonHx/blob/master/src/MainLime.hx#L280

@dpavicic
Copy link
Author

Thanks man, that was fast. It was indeed 2D stuff.
Btw, do you plan maybe to make the Kha backend also?

@vujadin
Copy link
Owner

vujadin commented Dec 26, 2016

I've updated lime template, they have changed lime api again...
Kha support was planned from the beginning but its not possible right now because of how kha handles shaders. I've had a chance to meed Robert (kha author) at haxe conference this year and he promised me to implement features I need to make bhx work with kha... there should be and issue opened in kha repo by me, about runtime shader compilation (Robert told me to open that issue as a remainder for him), but I guess he gave up the idea...

@dpavicic
Copy link
Author

Too bad ... Haxe is really missing a good 3D engine ( for all possible backends ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants