Colored BitmapText

Sometime between 14th and 21st, the jme3 SVN branch stopped rendering colorised BitmapText (BitmapText.setColor()) with the right colour (or even the right alpha).



I can produce a test case or narrow it down to a particular revision if needed, but maybe someone already knows what the problem is.



-davidc

davidc said:
I can produce a test case or narrow it down to a particular revision if needed, but maybe someone already knows what the problem is.

I don't think anyone is aware of this issue.
Yeah a test case and the revision would be great.
this revision could be a good start I guess
http://code.google.com/p/jmonkeyengine/source/detail?spec=svn6768&r=6768

maybe @mulova can help

thank you

Indeed, this revision is the problem, see below.



I wonder if this new stuff should not have been put in a subclass anyway, to keep BitmapText fast for simple use?



Test case:



[java]



package net.davidc.egp.wiseup.tests;



import com.jme3.app.SimpleApplication;

import com.jme3.font.BitmapFont;

import com.jme3.font.BitmapText;

import com.jme3.math.ColorRGBA;

import com.jme3.renderer.queue.RenderQueue;

import com.jme3.system.AppSettings;



/**

  • @author David Croft (david@davidc.net)
  • @version $Id$

    */

    public class BitmapTextColorTest extends SimpleApplication

    {

    public void simpleInitApp()

    {

    BitmapFont font = assetManager.loadFont(“res/fonts/twcencondboldout.fnt”);



    BitmapText uncolored = new BitmapText(font, false);

    uncolored.setText(“One two three”);

    uncolored.setLocalTranslation(50, 400, 0);

    guiNode.attachChild(uncolored);



    BitmapText colored = new BitmapText(font, false);

    colored.setText(“Four five six”);

    colored.setColor(new ColorRGBA(0.9f, 0.5f, 0, 1.0f));

    colored.setLocalTranslation(50, 200, 0);

    guiNode.attachChild(colored);

    }



    public static void main(String[] args)

    {

    BitmapTextColorTest app = new BitmapTextColorTest();

    AppSettings settings = new AppSettings(true);

    settings.setResolution(600, 480);

    app.setSettings(settings);

    app.setShowSettings(false);

    app.start();

    }

    }

    [/java]



    revision 6767:





    revision 6768:





    -davidc

This has been fixed by @Mulova

check this post

http://hub.jmonkeyengine.org/groups/gui/forum/topic/bitmaptext-getlinewidth-always-returns-0/#post-118260

Hi,



i don’t know if it is the right place but it seems that there is a new bitmap text bug. My BitmapTexts always appear white no matter if i choose an own color or not. Any proposals what could cause the problem? I checked this issue by executing TestComboMoves. If i’m right the bitmaptexts below are usually colored (lines 90 - 106) but they appear white.



Regards

Moe

I am having the “white text” problem too:

http://i.imgur.com/jZMBo.png

The “Phr00t” text should be blue:

[java] btName = new BitmapText(Main.myFont);

btName.setColor(ColorRGBA.Blue);

btName.setText(Main.myWorld.Player.Name);

infoNode.attachChild(btName);[/java]

… but it is white :frowning: What is going on?



EDIT: I found the problem! You have to set the color AFTER you set the text. Swapping the setColor/setText lines above solves this problem.

Or update to a more recent build. I fixed this bug like a month ago or something.

2 Likes

I’m using Alpha-4… I guess I need to switch to the SVN release! Now to find out how to use the SVN version…

In jmp press F1. Read help on updating to nightly builds.

1 Like

Yay, updating to the SVN! Thank you :slight_smile: