jPCT-AE - a 3d engine for Android > Support

Black texture when enable mipmapping.

(1/1)

kiffa:
Some textures(Seems 2^n * 2^m, not 2^n * 2^n) will be black if i enable mipmapping, and be fine if i disable mipmapping. Codes:

OK:

--- Code: --- Config.glTransparencyMul = 1 / 255f;
    Config.glTransparencyOffset = 0;
    Config.farPlane = 7000;
    Config.unloadImmediately = true;
    Texture.defaultToKeepPixels(false);
    Texture.defaultTo4bpp(true);

    Texture.defaultToMipmapping(false);
--- End code ---

Black:

--- Code: --- Config.glTransparencyMul = 1 / 255f;
    Config.glTransparencyOffset = 0;
    Config.farPlane = 7000;
    Config.unloadImmediately = true;
    Texture.defaultToKeepPixels(false);
    Texture.defaultTo4bpp(true);

    Texture.defaultToMipmapping(true);
--- End code ---

Env:

--- Code: ---OS: Android 2.3.3\Android 4.2\Android 2.3\Android 4.0
Devices: Tegra2\Mali 400 MP\SGX 531\Adreno 203

--- End code ---

And if i enable ETC1 and mipmapping, app will crash on Tegra2. If i enable ETC 1, disable mipmapping, app runs fine. The crash will not happen on Mali 400\SGX 531\Adreno 203.

The crash log:

08-14 16:07:30.850: I/jPCT-AE(8233): Subobject of object 32/object34 compiled to indexed fixed point data using 30/20 vertices in 17ms!
08-14 16:07:30.850: I/jPCT-AE(8233): Object 32/object34 compiled to 1 subobjects in 18ms!
08-14 16:07:30.850: I/jPCT-AE(8233): [ 1376467650865 ] - WARNING: Texture's size is 256/128, but textures should be square for OpenGL ES2.0! This may result in a black texture!
08-14 16:07:30.860: I/jPCT-AE(8233): Creating buffers...
08-14 16:07:30.860: I/jPCT-AE(8233): [ 1376467650874 ] - ERROR: before: glError 1282
08-14 16:07:30.870: W/dalvikvm(8233): threadid=13: thread exiting with uncaught exception (group=0x401c0560)
08-14 16:07:30.870: W/System.err(8233): java.lang.RuntimeException: [ 1376467650874 ] - ERROR: before: glError 1282
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.Logger.log(Logger.java:193)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.GL20.checkError(GL20.java:147)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.GL20.glGenBuffers(GL20.java:1354)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.CompiledInstance.compileToVBO(CompiledInstance.java:1455)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.CompiledInstance.render(CompiledInstance.java:593)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2211)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.World.draw(World.java:1351)
08-14 16:07:30.870: W/System.err(8233):    at com.threed.jpct.World.draw(World.java:1091)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.woo3d.util.SkyBox.render(SkyBox.java:107)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.car.scene.Sky.update(Sky.java:90)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.car.scene.SceneRoad.beforeRender(SceneRoad.java:71)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.woo3d.defaultimpl.DefaultSceneManager.beforeRender(DefaultSceneManager.java:512)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.woo3d.components.GameRenderer.handleGameRender(GameRenderer.java:456)
08-14 16:07:30.870: W/System.err(8233):    at com.zwenyu.woo3d.components.GameRenderer.onDrawFrame(GameRenderer.java:140)
08-14 16:07:30.870: W/System.err(8233):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
08-14 16:07:30.870: W/System.err(8233):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)




kiffa:
Another question: Does mipmapping increase the loading time(texture file -> vm memory -> GPU)  heavily? I feel it's obvious slower than which disable mipmapping.

EgonOlsen:
Just read the log... ;) It prints out a line that suggests to avoid non square texture because they might appear black. It's a gl issue, there's nothing i can do about it.

About the loading times: Yes, it increases load time but it shouldn't be that much. It looks better and renders faster, so it's worth the extra loading time IMHO.

No idea about the crash. Might be a driver bug. I've never ever come across a Tegra 2 based device.

Navigation

[0] Message Index

Go to full version