Slick Util Font not displaying right texture [Solved]

Started by Manux, January 11, 2012, 03:14:53

Previous topic - Next topic

Manux

Hi!
I'm trying to using Slick-util's Font class. As in another thread I saw in this forum, it works when I don't do any other rendering.
When I do, it seems either the texture font is corrupted or something else happens, as the opengl texture that is used to render the text is another texture which I load(after or before, neither work). Although, in the first few frames it works. But then the wrong texture gets used.

I tried a few things, but to no avail.

Any help is appreciated!

Evil-Devil

Though this is not the slick help forum. Could you show some source? Without its hard to tell what is going wrong.

Manux

Honestly, I don't know what to paste.

I have code that renders terrain, and then code that renders the units, and then the text is rendered.
If the code that renders the units is called, then it works. Like by magic.

I've tried to look for the difference in OpenGL calls. But I can't see anything except this one thing: my terrain is rendered using a display list, and there are texture calls in my display list. Is this a Bad Thing?

Manux

Actually, after a little research, I found that in the TextureImpl class, the texture only binds if the last bound texture is, of course, not the one we are trying to bind. It's logical. But since my terrain's texture binding is done in a display list, well TextureImpl's last bound texture doesn't change, so TextureImpl thinks that the bound texture is still the font's texture (because it keeps a Texture reference and doesn't check the actual bound texture of openGL), and so does not do what it's supposed to do.

I just call
TextureImpl.unbind()


The reason why it worked when I was drawing units is that I was updating the last bound texture, then binding the font. For some obscure reason my units were displaying correctly (they are drawn just after the display list).

Well, now it works.