problem using LWJGL with slick image support

hey,
i’m currently trying to use slick-utils with my lwjgl game framework. the main reason to use slick-utils was because of its TrueType font support. after the fonts were working i used the complete slick.jar instead of just the slick-utils.jar and changed my code to work also with the slick image object. basically everything works now but there’s one litte annoyance:
sometimes grey vertical lines appear at the edges of the textures.
here’s a screenshot:

(you might have to turn up the brightness on your monitor to see it)

it sometimes appears, sometimes not, and the brightness of the lines changes from time to time. i can’t find out what causes this behaviour but that’s probably because i’m not too familiar with the openGL stuff. it might be related to the mixture of slick code and do-it-yourself LWJGL code but as i understood it should be possible to use a combination of LWJGL and slick.

does anyone have an idea what the reason could be?
thx for any feedback.

btw, here are some details about my screen and the slick library:
Thu Nov 13 13:18:01 CET 2008 INFO:Slick Build #237
Thu Nov 13 13:18:01 CET 2008 INFO:LWJGL Version: 2.0rc1
Thu Nov 13 13:18:01 CET 2008 INFO:OriginalDisplayMode: 1280 x 800 x 32 @60Hz
Thu Nov 13 13:18:01 CET 2008 INFO:TargetDisplayMode: 640 x 480 x 0 @0Hz
Thu Nov 13 13:18:01 CET 2008 INFO:Starting display 640x480

That’s caused by having the texture coordinates out by 0.5 of a pixel I think.

Cas :slight_smile:

i noticed that rotation and scaling of an image seems to have an influence on other images. i’m sure that’s bullshit but this is what i currently see:

i have one image (a cannon) which needs to be rendered with a defined rotation angle. all other images are static (no rotation and scaling)
when i comment out the scaling and rotation in the code which draws the cannon, all other images are drawn just fine (ie. no grey lines appear).

is there something wrong with the way i use scaling and rotation?


// this leads to grey lines around the other (static) images
image.setRotation((float) Math.toDegrees(object.angleRadians));
image.draw(x, y, (float) object.scale); 

// this doesn't (but obviously i cannot draw rotated objects any more)
image.draw(x, y);

I also posted this at the slick forum: http://slick.javaunlimited.net/viewtopic.php?t=1326

That might be caused by texture clamping issue. I don’t what Slick uses, but setting the wrap mode GL_CLAMP or even better, GL_CLAMP_TO_EDGE for the textures might help here.

i tried this:


GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);

but it had no effect at all.
GL_CLAMP_TO_EDGE seems to be only available in OpenGL 1.2

Just to be sure, did you set them both?


GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);

Use CLAMP_TO_EDGE if it’s available; if not use CLAMP.

Cas :slight_smile:

(If there is no CLAMP_TO_EDGE, CLAMP is usually incorrectly implemented and does the same thing as CLAMP_TO_EDGE.)

not at the time when i wrote my reply. but i’ve tested it again with both statements and it still has no effect.