1
\$\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\$
0
\$\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

| improve this answer | |
\$\endgroup\$
  • \$\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 Jun 12 '16 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 Jun 12 '16 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 Jun 12 '16 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 Jun 12 '16 at 10:22
  • \$\begingroup\$ Ofcourse, please put your render method in your question, so we can analyze it. \$\endgroup\$ – Keey Jun 12 '16 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.