2
\$\begingroup\$

I load Bitmapfont then try to draw it, but on PC(desktop) build screen blinks with frequecy that I can judge that backbuffer is not drawn. On Android all is fine, I don't see blinking. I simply do this:

SpriteBatch = new SpriteBatch();
Bitmapfont font = new Bitmapfont();
font.setColor(Color.GREEN);
spriteBatch.begin();
font.draw(spriteBatch, "Hello world", 0, 100);
spriteBatch.end();

Ways to fix?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Do you have called that in your render method:

Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

Because, it looks like your code should work.

We figured out, that he needed to disable, because he wanted to draw the Screen on demand

"continuus rendering" https://github.com/libgdx/libgdx/wiki/Continuous-%26-non-continuous-rendering

\$\endgroup\$
7
  • \$\begingroup\$ good point. I did it in show() because i do some app initialization there and wanted to display message. I guess some List of messages is needed to put it in render() method and render it properly. Only way? \$\endgroup\$
    – tohaz
    Commented Jun 12, 2016 at 10:17
  • \$\begingroup\$ You need to clear your frame nearly always in the rendermethod (prefered at the start of thr render method. And in show it would be nearly useless, because show is called only once. \$\endgroup\$
    – Keey
    Commented Jun 12, 2016 at 10:18
  • \$\begingroup\$ i disable all drawing untill initialization is done and it works, just text is blinking. :) maybe there is a way to font.draw() in both buffers... \$\endgroup\$
    – tohaz
    Commented Jun 12, 2016 at 10:21
  • \$\begingroup\$ I have identical code, it doesnt blink, show me your render method please, edit your question for this extra information \$\endgroup\$
    – Keey
    Commented Jun 12, 2016 at 10:22
  • \$\begingroup\$ Ofcourse, please put your render method in your question, so we can analyze it. \$\endgroup\$
    – Keey
    Commented Jun 12, 2016 at 10:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .