Texture question

No big problem, but I’m curios (maybe I learn something about textures)

I use a small 32x32 png texture for the typical “red-cross-health” item. I use a light gray as border of my image. However, in the game you can see that the edges of the box are not only gray, but also have some red in it.

Here is a sceenshot (the small thing is the image I’ve used):

And here is the code I use to load the texture:

TextureState ts = display().getRenderer().createTextureState();
Texture t = TextureManager.loadTexture(texture, Texture.MM_LINEAR, Texture.FM_LINEAR, ts.getMaxAnisotropic(), true);

Do I make something wrong?

Try using different wrap modes on your Texture such as border clamp

The setWrap didn't work, I get the colored border with all of the settings. As I said, this is no big deal…

By the way: Using WM_BCLAMP_S_BCLAMP_T brought down my FPS near zero (I really added it to the box only). Looking in another direction I had 60~80 FPS. The other settings had no such impact…

I don't see how a wrap mode could bring your card to its knees, if that is true, there must be a bug in the driver you are using.  Have you tried edge clamp, regular clamp, or wrap_wrap?

Yes, I tried all clamp modes and it didn’t help.

But it can be worse, look at this:

coming from this picture:

This is a 64x64 PNG (the red cross was just 32x32). The PNG was not antialiased, but with such stairs, there must be something wrong, either with my code or with my video card/driver.

I’ll load the example on another PC with a newer card, let’s see if I still have the “stairs”.

Are you sure you don't have any transparent/translucent pixels on these images?  That would explain your troubles quite well I should think. :wink:

Texture compression on that arrow maybe?

It doesn't seem very likely given the big step things, but you could try loading with code like this:

Texture t = TextureManager.loadTexture(




//Make sure we don't use compression, which makes skyboxes look awful




I mainly noticed the S3TC on images with gradients (skyboxes) which looked awful, sub-16bit quality. It might do something like the stepping you are seeing as well. I wouldn't have thought it would cause the odd effect on the red cross symbol either, but you might want to have a look.

THANK YOU shingoki! That was the reason (also for the red cross). So I have to use your code for all textures like this.

PS: I'll put the next version (with that issue and a memory leak fixed) in the "User Showcase" forum. People here help me so much, it's time to show something.

It's a learning game, mainly for Japanese (Kana and Kanji), but you can learn other alphabets (Greek, Hindi, Russian, Korean) and similar things (e.g. Morse code) with this as well…

Excellent, glad that helped :slight_smile: I'm looking forward to seeing your app, I quite fancy learning kana, kanji would be a bit much for my brain though I think :slight_smile:

Here is the thread: http://www.jmonkeyengine.com/jmeforum/index.php?topic=4324.0

@shingoki: ああ、日本語 の べんきょう します か。 がんばって。

i don't think s3tc compression should be default like it is now with that loadTexture method…renanse? mojo?

i have to agree with that

Yeah, it certainly seems like one of the more common questions that need answered. I don't have a problem with changing the default.

Deja vu!!!

The "stairs" are back, and my skyboxes look terrible, despite the fact that the code was working a while, and I didn't touched it:

Mmmmm… Do you initialize your display with a 32 bit color depth ?

A 16 bit color depth gives an horrible stair effect on gradients.

I try to set 32 bit (basically, just loading the config file), but maybe I make something wrong. As the other settings like sceen resolution can be set without problems, I assumed that this is also the case for colors. Is there a really safe way to determine the current color depth?

Copy/paste this somewehere in your code :


Does your desktop is in 32 bit color depth ?

Yes, and I even set in the OpenGL config that it should always use 32 bit.

Arg !!! You have an ATI 3D card ?!

This horrible thing could be the source of your problems  :slight_smile: .

If you use neither JPG file nor DDS files, I don't know what happends…


My card is an ancient GeForce MX 460 (a new one should be available the next few days). For the affected textures I use PNG. BTW, it can't be neither graphic card nor texture format, as the code was already running  :cry:

So the only thing I can try is to set up a little test class…