Slick Forums

Discuss the Slick 2D Library
It is currently Sun Nov 28, 2021 11:10 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Feb 18, 2012 1:19 am 
Offline

Joined: Thu Nov 05, 2009 3:38 pm
Posts: 21
Hi,

I'm running into the same problem as this guy here:
http://stackoverflow.com/questions/7044 ... -correctly

I try to load a non-power-of-two-size image with the Slick-Util TextureLoader.
I understand that OpenGL wants textures in the right size, but the TextureLoader does exactly put the image to this correct sizes, right?
Then why are these artefacts at the border of the texture rendered?

Maybe I could avoid this problem if I don't render the complete texture on a quad with size let's say 512x512 with texture coordinates (0,0), (0,1) and so on...
I could also render a quad with the exact image size i. e. 180x60 and use texture coordinates like (0,0), (0,0.4) or so... but the first alternative is much more comfortable...

Any ideas?

Thanks in advance and kind regards,
Stefan


Top
 Profile  
 
PostPosted: Sat Feb 18, 2012 1:33 am 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Slick doesn't "fix" power of two sizes; it only ensures that the actual OpenGL texture will be power-of-two sizes. So the Texture object returned may have different results for getImageWidth (e.g. 500) and getTextureWidth (e.g. 512). You can find out the ratio (i.e. for texcoords, 0.9765) using Texture.getWidth.

More details:
viewtopic.php?p=25911#p25911


Top
 Profile  
 
PostPosted: Sat Feb 18, 2012 12:03 pm 
Offline

Joined: Thu Nov 05, 2009 3:38 pm
Posts: 21
It's clear now, thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group