Giter Site home page Giter Site logo

Comments (13)

vujadin avatar vujadin commented on August 25, 2024

Indeed this would be great - especially because BabylonHx was created to be used as a 3D engine in http://gamestudiohx.com/ (which already has very powerful and complete 2D features).
But the problem is that this is not possible yet, see here openfl/openfl#35

from babylonhx.

labe-me avatar labe-me commented on August 25, 2024

Ok, they said it is actually possible but we have to make sure that GL is in a clean state so openfl displaylist can work.

@dazKind points us to the cleanup code used in foo3D: https://gist.github.com/dazKind/9082219

I am looking at the lost context problem and will see if I can force the cleanup… maybe the Engine will have to keep track of some IDs? I am not sure about the details…

from babylonhx.

labe-me avatar labe-me commented on August 25, 2024

I can make the displayList (a textearea + a bitmap) appear using the following lines after GL.flush() but then the babylon view disappear…

    GL.disable(GL.CULL_FACE);
    GL.useProgram(null);
    GL.bindBuffer(GL.ARRAY_BUFFER, null);
    GL.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, null);

I imagine the babylonhx context has to be restored at the beginning of the next frame.

from babylonhx.

onatbas avatar onatbas commented on August 25, 2024

In my opinion this is crucial. How else are we going to implement ui :) is this actually possible? I know that in away3d port you can do that. Sorry i have very basic knowledge of how gl works, im trying to understand if babylon is really fit to my current projects needs.

from babylonhx.

vujadin avatar vujadin commented on August 25, 2024

The latest commit allows mixing BabylonHx with OpenFl display list (tested only on Windows/C++). I've successfully added few sprites above 3D scene and some haxeui controls too. It crashes however sometimes with click/hover events on haxeui controls but I made a few very basic/dirty examles ... Anyway, consider this a VERY experimental change.

from babylonhx.

onatbas avatar onatbas commented on August 25, 2024

Thanks for taking this into consideration first :) i tested this on iPhone 5 and Mac(C++), both reproduces the following situation: i can add blank sprites (nothing new), but now if i draw a rect oh sprite.graphics and/or add a bitmap into it, babylonview disappears but i can see the content of the sprite. i will test on android once i get the device on my hand.

from babylonhx.

vujadin avatar vujadin commented on August 25, 2024

I have no such problems on win build, and neko build works too. However, I'm seeing huge difference in CPU usage - 3D+2D mix takes a lot more CPU then pure 3D on win build, neko build doesn't suffer from this problem.

3d 2d

The problem you have might be connected to where in the code you add 2d content. In my example, I'm placing 2d code in 'SceneLoader.Load' function, when the scene is created and loaded, right below 'scene.executeWhenReady'. Basically you add 2d stuff at the bottom - when you're done with 3d

from babylonhx.

labe-me avatar labe-me commented on August 25, 2024

Great,

In my tests flash.text.TextField is incompatible with particles…

When I have particles and a textfield, particles disapear and the textfield is unreadable.
When I disable particles the textfield is correctly rendered.
When I remove the textfield particles appear.

from babylonhx.

labe-me avatar labe-me commented on August 25, 2024

Strangely, adding a bitmap make the particles appear (but text is still unreadable white squares).

from babylonhx.

labe-me avatar labe-me commented on August 25, 2024

And bitmap alpha is black.

image

from babylonhx.

dazKind avatar dazKind commented on August 25, 2024

Looks like texfields or particles have some leaking state. Make sure you reset the blendfunc to SRC_ALPHA and ONE_MINUS_SRC_ALPHA. That should fix the missing alpha.

from babylonhx.

labe-me avatar labe-me commented on August 25, 2024

Concerning the FPS loss, I have the same experience with IOS.
Anyway using the regular openfl display list isn't a solution for games since it is mainly software based and would slow down things.

I am afraid babylonhx is missing the regular 2d accelerated stuff (bitmapfont, spritesheet, sprites, etc). It's logical since babylonjs only targets html and relies on html/css for the UI.

from babylonhx.

vujadin avatar vujadin commented on August 25, 2024

Sprites and 2D layers are actually on the list of Babylon features. They can be used as a starting point for building some kind of UI.
Check 'Scene #1' example in features tests on BabylonJs site.

from babylonhx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.