1
\$\begingroup\$

Working on a java game that uses some pngs images for icons/textures. A few images ( fewer than 5, out of dozens ) are showing some odd parallel "artifact" lines. They move with the image, are certainly not in the PNG itself.

I can't figure out what's causing it. Using slick2d, lwjgl. I've tried slcik2d and opengl methods of clamping textures but that didn't help.

enter image description here

This black line is showing off the right-hand side of an icon (maybe 50% of the actual image width away). It should not be there.

\$\endgroup\$
  • \$\begingroup\$ Are you doing any graphics.translate(x, y) calls? Because I've had the same problem before and I fixed it before in my own game \$\endgroup\$ – Samich Apr 6 '14 at 18:51
1
\$\begingroup\$

i think that is because textures are loading using power of 2. and you are probably using the texture width and height to render the image onto a quad. what you should do instead is use the images relative size from withing the texture.

it should be a floating point number such as 0.67080760(or something) since 1f would be the total width and height of your image.

I only say this because i ran into the same problem when i started working with lwjgl(ive never used slick2d but its based on lwjgl) and what i suggested fixed the image irregularity.

| improve this answer | |
\$\endgroup\$

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.