[SOLVED] ”Non-power-of-two textures are not supported.” Which image is it talking about?

Hi,



I got this error when running my game on android:

com.jme3.renderer.RendererException: Non-power-of-2 textures are not supported by the video hardware and no scaling path available for image: Image[size=1196x720, format=RGBA8, id=70001]


Now, I have done another program with out getting this problem. And in neither of my programs I use ^2 images so frequently.
Is it some special image that must be ^2 to work?
Because now it is loading the main screen, and the background is an image of 800x500.
If I were to make it 512x512 the image would be ruined.
The image would be stretched and look really wierd.
All buttons would be ruined. Simply everything that is not a perfect square will be messed up.
So I assume this is not the solution..

What is the solution to this error?

I thought jME scaled it for you if it wasn’t n^2 before sending it to the graphics card.



Anyways you could try a 512 x 256 or 1024 x 512 (i don’t think it has to be square). That would scale better for your current resolution

1 Like

It doesn’t have to be square. Each dimension has to be a power of two though, it’s a limitation of graphics cards.



jME3 silently converts the Image for you if its the wrong dimensions, I’ve no idea why it wouldn’t be doing that in this case though.

1 Like
@Addez said:
Hi,

I got this error when running my game on android:


Now, I have done another program with out getting this problem. And in neither of my programs I use ^2 images so frequently.
Is it some special image that must be ^2 to work?
Because now it is loading the main screen, and the background is an image of 800x500.
If I were to make it 512x512 the image would be ruined.
The image would be stretched and look really wierd.
All buttons would be ruined. Simply everything that is not a perfect square will be messed up.
So I assume this is not the solution..

What is the solution to this error?


Stretch your image to 1024 x 512. It won't look weird because the target shape is still the same... unless you are using Picture but then that's a problem, too.
1 Like

It says no scaling path available for image so either it has been procedurally generated or it was embedded in the J3O/Blender model. Right now the Android renderer only scales images that were loaded from image file assets, it doesn’t handle procedural or embedded images.

3 Likes

I work in eclipse, and I add jars to the build path. But I think I might have missed the one jar containing the scaling methods…

The jars I got now is:

jME3-plugins

jME3-effects

jME3-lwjgl

eventbus

xmlpull-xpp3

jbullet

vecmath

nifty

jME3-jbullet

jME3-niftygui

jME3-core

jME3-android



Is there anywhere I can have some sort of index of which methods are in which jars?

@Momoko_Fan said:
It says no scaling path available for image so either it has been procedurally generated or it was embedded in the J3O/Blender model. Right now the Android renderer only scales images that were loaded from image file assets, it doesn't handle procedural or embedded images.


According tot his there are no scaling methods.
1 Like

Yeah. We can add this feature of course, but to have hardware accelerated scaling it would require converting the image to an Android Bitmap object first (possibly using ImageRaster) and then doing the scaling - it is much slower though, this is why it is recommended to just make sure the images are power-of-2 to begin with.

1 Like
@EmpirePhoenix said:
According tot his there are no scaling methods.

I don't use j3o or blender models, I only use xml models..

Which texture formats are you using? Maybe you’re using TGA or DDS by any chance?

1 Like
@Momoko_Fan said:
Which texture formats are you using? Maybe you're using TGA or DDS by any chance?

Nop. png on all images..
Funny thing is, I can't find any image that has the size 1196x720 that it is talking about..
I'm going to try to use the SDK even tho I don't like it.
I just created a new project and it is directly complaining about some junity libary to be defined :(
@Addez said:
I just created a new project and it is directly complaining about some junity libary to be defined :(


"Edit: A small issue with a wrong junit library import in the BasicGame template has been fixed in a stable update already, just update the SDK via Help->Check for Updates. You can ignore and “Reference Problems” for junit in RC2 projects if you encounter them and just remove the junit references from your projects Library settings." - http://hub.jmonkeyengine.org/2012/10/03/jmonkeyengine3-sdk-rc2-released/
1 Like
@Addez said:
Nop. png on all images..
Funny thing is, I can't find any image that has the size 1196x720 that it is talking about..
I'm going to try to use the SDK even tho I don't like it.
I just created a new project and it is directly complaining about some junity libary to be defined :(


What is the resolution of the display? Do you do anything like post processing or otherwise write to frame buffer textures or whatever?
1 Like
@pspeed said:
What is the resolution of the display? Do you do anything like post processing or otherwise write to frame buffer textures or whatever?

THANK YOU!!
I found the real issue!
[java]private void setupProcessor() {
fpp =new FilterPostProcessor(assetManager);
CartoonEdgeFilter bloom=new CartoonEdgeFilter();
bloom.setDepthThreshold(.1f);
fpp.addFilter(bloom);
viewPort.addProcessor(fpp);
}[/java]
I add this cartoon edge. But it seems to be causeing the problems..
:( This is bad.. Because I really needed this effect for my game..

you shouldn’t be using any post processors in your android game really. If by some miracle they work on your phone (which as you point out, they don’t :P) they will fail on many other devices

1 Like
@wezrule said:
you shouldn't be using any post processors in your android game really. If by some miracle they work on your phone (which as you point out, they don't :P) they will fail on many other devices

Ok.. And there is no way to achive that edge effect without a post processor?
@Addez said:
Ok.. And there is no way to achive that edge effect without a post processor?


Not easily, anyway. There are some old school tricks for doing cartoon like outlines and flat coloring in isolated cases but they have lots of limitations and sometimes require the geometry to be constructed in a very specific way. At least that's my experience.
1 Like

Okej,

Thanks all for your help! I am most greatful :slight_smile: