java - JVM crashes when using MipMaps on small textures on Windows -


i'm writing code loads ad-hoc textures @ run-time. texture load specified user have no knowledge of prior loading it.

some of textures can quite large , scaled lot, i'm using texturefilter.mipmaplinearnearest min filter. hence, load texture usemipmaps set true...

texture texture = new texture(imagefile, true); 

the issue on windows jvm dies fatal error if user specifies image 1 pixel high.

one solution check loading texture without mipmaps enabled in order check size, reload mipmaps enabled if size greater 1, i'd avoid having load twice.

is there more efficient way around issue?

i've found better workaround. can load file once pixmap, use construct texture conditionally.

here's ended with...

pixmap pixmap = new pixmap(imagefile); boolean usemipmaps = pixmap.getwidth() > 1 && pixmap.getheight() > 1; texture texture = new texture(pixmap, usemipmaps); texture.setfilter(usemipmaps ? texture.texturefilter.mipmaplinearnearest                               : texture.texturefilter.linear,                   texture.texturefilter.linear); 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -