Problem with FengGUI

Hi friends,



My FengGUI's objects can't render before my JME's model objects. They are always behind!



FengGUI's objects are always in front of JME's objects like skybox, box… . However, they are always behind model objects like car model in lesson9.



P/S: I referenced FengGUI & JME integration tutorial and also use source code on these tutorials.

What game type are you using, StandardGame or SimpelGame, BaseGame?

How and where are you rendering FengGUI in a separate Gamestate or simply in the render method?



Also, are you calling root.updateRenderstate() after attaching your model to the node?


pManager.renderPasses(display.getRenderer());
display.getRenderer().clearZBuffer();
for(RenderState rs : display.getRenderer().defaultStateList)
     rs.apply();
GL13.glActiveTexture(GL13.GL_TEXTURE0);
guidisp.display();

I tried again to use Trussell's code. But It's still to display as I was told.



Moreover, I'm implementing from GameState class.

make sure that th FengGUI GameState is the last you attach to the GamestateManager.

I use JMonkey & FengGUI objects in a GameState. The problem happens when JMonkey objects is set to QUEUE_OPAQUE.



For example, It's ok with FengGUI objects if I try to make a box without QUEUE_OPAQUE (like FengGUI&JMonkey tutorial).

Why do you want to Queue them to be Opaque? Queue them to be Ortho.

I think he has some transparent and some opaque objects in his scene.



I modified the wiki example, now one Box renders in the Transparent queue, and one in the Opaque.



I ran into similar problems as dinhnguyenquoc mentoned.



To make it work (more or less) i had to:

  • add a Alphastate to the root node

      without the AlphaState, the Opaque Box is rendered in front of FengGUI
  • explicitly render the Transparent Box in the Transparent Queue and the Opaque in the opaque :slight_smile:
  • add a CullState, so the Backfaces are not rendered



    But somehow FengGUI is now rendered transparent also, i didn’t manage to display FengGUI with a solid color.  :x



Hi Core-Dump,



Have you ever try to test with Terrain object?



I get some problem with terrain & skybox object. They transparent each other.



In my project, there are Skybox, model objects (collada) need to set queue to opaque!

if you provide a small test case which shows off your problem, its easier to help :slight_smile:

there are many things that can go wrong.

Hi Core-Dump,



Just add Skybox & terrain (set Queue to Opaque) into your tutorial http://www.jmonkeyengine.com/wiki/doku.php?id=fenggui_jme_appl_using_standardgame to test!  :smiley:


ok, i give up i can't make it work :slight_smile:

stuff in the opaque or transparent queue are always rendered in front of fenggui it seems.

i guess its only possible to handle Fenggui nicely with a separate renderpass.  :?

i know this problem we fixed it like coredump mentioned.it works with renderpasses

There we go finally.





Left with GameStates/GamestateManager, right with the same GameStates but wrapped in RenderPasses.



The wiki entry is updated with a renderpass example.



I made two simple RenderPass wrapper classes for GameState and BasicGameState, so you can use your existing GameStates (similar to the TestIsland set up)


That's great, Core-Dump!



My problem is left picture. You  used a separate renderpass to make like right picture. So I greatly appreciate your help.



However, a minor problem I need to solve is about FengGUI. Can you make FengGUI objects are transparent?



P/S: Do you still remember a mention with Quad to render FengGUI objects. I used to apply that mention to make transparent FengGUI objects!  :smiley:

You can make the background color of the FengGUI containers transparent.

The main window and radio button panel have a alpha value of 0.3.

They add up, so the result alpha of the radiobutton panel is 0.6 (more or less).


window.getAppearance().add(new PlainBackground(new Color(0.5f, 0.5f, 0.5f, 0.3f)));
buttons.getAppearance().add(new PlainBackground(new Color(0.5f, 0.5f, 0.5f, 0.3f)));


Thanks Core-Dump,



You solved absolutely my problem!

Hi Core-Dump,



Could you add InputHandler object into IngameGameState?



And then, could you remove mouse (mouse symbol) on screen?



P/S: Even I tried remove FengJMEInputHandler, It still displays!

the example uses a FirstPersonController which works for me.

Sorry Core-Dump,



In your tutorial, do you see an input handler (mouse) still exist even if you don't use any input handler in FengGui.



I actually want to remove it!  :smiley: