[SOLVED] BitmapText throws and OpenGL OOM error when…

BitmapText throws and OpenGL OOM error when you set the text to “” on the Note 2 & the Tab 2. Fairly sure there are a few other devices out there that do the same thing.

Test case:
[java]
BitmapText bitmapText = new BitmapText(guiFont, false);
bitmapText.setText(“Testing”);
rootNode.attachChild(bitmapText);
bitmapText.setText("");
[/java]

Yeah… that was tough to put together :wink:

I know why this is happening now, so I can at least explain what causes the problem so someone can fix it:

These devices DO NOT LIKE an empty Vertex buffer. Setting the string to “” pushes out an updated buffer with nothing in it.

On a side note, the android issue I was seeing with my library was this… I removed the offending set and all of my games worked! Yay… was expecting it to take a week or so to track this issue down and fix it once the Tab 2 got here…

That’s a bit odd, since jME3 will not render empty meshes at all, i.e. they will never be sent to the GPU. Can you post the entire test case maybe?

@Momoko_Fan said: That's a bit odd, since jME3 will not render empty meshes at all, i.e. they will never be sent to the GPU. Can you post the entire test case maybe?

Sure… it’s just the standard simple app with the code above in the init method.

I can verify that the buffer is being sent to the GPU… whether or not it is attempting to render… no clue, but the empty buffer is being pushed to the GPU. I set up a test Mesh and did the same thing… and low and behold… OpenGL reports an OOM error.

Gimme a few to post the test.

Here it is:

[java]
package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.font.BitmapText;
import com.jme3.renderer.RenderManager;

/**

  • test

  • @author normenhansen
    */
    public class Main extends SimpleApplication {

    public static void main(String[] args) {
    Main app = new Main();
    app.start();
    }

    @Override
    public void simpleInitApp() {
    BitmapText bt = new BitmapText(guiFont, false);
    bt.setText(“Testing”);

     rootNode.attachChild(bt);
     
     bt.setText("");
    

    }

    @Override
    public void simpleUpdate(float tpf) {
    //TODO: add update code
    }

    @Override
    public void simpleRender(RenderManager rm) {
    //TODO: add render code
    }
    }
    [/java]

@Momoko_Fan
Just making sure you got the test since I had to recreate the project before I could post it. I trashed the first one once I ran it.

@t0neg0d

Would this also be related to the indicator error?

Aaaah man, I completely forgot about that one.
Yeah, that is true, I remember now that I also get that in my android games.
What i do is in my gui components when ever I get a empty string on the setText I will set the text to a space " ".
That did the trick. But still, jME should not behave like that.

1 Like
@BigBob said: @t0neg0d

Would this also be related to the indicator error?

This was… and I fixed it today… yay!

BitmapText deservedly takes a lot of heat… but I wonder if this would happen with any mesh with an empty VertexBuffer or if BitmapText does something strange with it that triggers the issue.

@pspeed said: BitmapText deservedly takes a lot of heat... but I wonder if this would happen with any mesh with an empty VertexBuffer or if BitmapText does something strange with it that triggers the issue.

Yes it does… I reported that in the second post explaining what was causing the issue. The reason this is being reported as a BitmapText error is that this is where people are going to run into this using provided JME classes. There isn’t another class that I am aware of that is going to push out an empty vertex buffer to the GPU just by calling a methods like setText(""); And in more cases than not, this is how the user would clear the displayed String.

What troubles me even more though is that @Momoko_Fan said the JME doesn’t do this and a 3 line test cases shows otherwise.

EDIT: Don’t take this the wrong way… The biggest reason I’m trouble by the statement is, I spent about a month going through my code line by line trying to figure out what I did wrong, not even considering that it may be an issue with a JME class. 600+ dollars later and 20 minutes of my time, I find out that I spent hours+ a day for that month trying to find a bug that didn’t exist =(

EDIT 2: Best 600+ dollars I’ve spent… the Note 3 is awesome… and I like having the Tab 2 as is one of the Samsung trouble devices.

@t0neg0d

The tab 2 is my default (and only) test device, and it is quite a blessing to have the assurance where if runs on this device it should run on all devices!

Im looking forward to trying out the indicators once again

1 Like
@BigBob said: @t0neg0d

The tab 2 is my default (and only) test device, and it is quite a blessing to have the assurance where if runs on this device it should run on all devices!

Im looking forward to trying out the indicators once again

As far as I can tell with lots of reading and the 7 or so devices I have access to for testing, if your game runs on the Tab 2… you can feel 99.9% assured that it will run on most devices (supporting your target version… I aim for 2.2 or higher right now… but this will change when the new audio renderer is available via a stable release–at that point I think it’s 3.2 or higher?).

Anyways, I wish I had been aware of this when we picked up out first tablet… it would have been the one I bought.

It could be maybe that the normal lwjgl render is good about not sending empty buffers but that the OpenGL ES renderer isn’t. (shrug)

This issue was fixed on September 13th.

https://code.google.com/p/jmonkeyengine/source/detail?r=10775

1 Like
@Momoko_Fan said: This issue was fixed on September 13th.

https://code.google.com/p/jmonkeyengine/source/detail?r=10775

Awesome! So I take it that this is not in the current stable release and why I was still seeing the issue?

This change was not in the stable branch for some reason. Anyway, I merged it in now.

@normen: any idea when the next stable build based off the 3.0final branch will happen?

As soon as its merged back to svn. @Momoko_Fan

@Momoko_Fan: I don’t see any commits to the 3.0 branch…? Did you do it in svn only? Then you basically broke our merging now. You also didn’t update the version number, so now theres an update out with the same version number but changes… -.-

Okay, I fixed this, upped the version to 3.0.10 and merged back to svn. Please don’t change the svn repo manually anymore, only change the git 3.0 branch and merge back to svn.

1 Like