LWJGL
June 17, 2013, 22:32:20 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL is now using GitHub
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Slick Util Font not displaying right texture [Solved]  (Read 1239 times)
Manux
Newbie
*
Posts: 3


« on: January 10, 2012, 19:14:53 »

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!
Logged
Evil-Devil
Prolific Timewaster
****
Posts: 299



WWW
« Reply #1 on: January 20, 2012, 06:08:16 »

Though this is not the slick help forum. Could you show some source? Without its hard to tell what is going wrong.
Logged
Manux
Newbie
*
Posts: 3


« Reply #2 on: January 24, 2012, 14:18:38 »

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?
Logged
Manux
Newbie
*
Posts: 3


« Reply #3 on: January 25, 2012, 06:32:21 »

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
Code:
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.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!