[SOLVED] Android: OpenGL error on textures

edited October 2011 in Help request
Ugh, every day a new issue...

In this case, I'm moving from my title screen (text only) to an actual scene with textures. However, no matter which of my scenes I load, I get the following error:
D/ORX(11400): <DISPLAY> (orxDisplay_Android_LoadBitmap() - include/../plugins/Display/android/orxDisplay.c:1879) valid pkm file not found loading uncompressed file
D/ORX(11400): <ASSERT> (orxDisplay_Android_LoadBitmap() - include/../plugins/Display/android/orxDisplay.c:1965) [Assertion failed] : <eError == GL_NO_ERROR && "OpenGL error code: 0x501">

It seems the program can load my font images (.tga) just fine, but when it comes to my actual sprites (.png), it searches instead for a .pkm file, doesn't find it, and then crashes. I noticed that the OrxTest project has most of its sprites stored as .pkm, and that runs perfectly.

Am I supposed to convert the sprites myself, and if so are there instructions on doing so? I can't seem to find anything conclusive online. And if that's not the issue, what is? I know the OpenGL code 0x501 is thrown by glTexImage2D() when the texture has bad values (non power-of-two dimensions, &c), but it works with the OrxTest images without error.

Comments

  • edited October 2011
    Ha, well, don't I feel sheepish.

    My own silly error: I had a very long texture (part of an animation) that was 7680 pixels wide. Which is rather a lot.

    Scaling the image down a bit (to 960 pixels wide) fixed the problem.
  • edited October 2011
    Now that you're doing the questions and the answers, we don't even have time to say hi! in the meantime. :)
  • edited October 2011
    I know, it's a rather one-sided argument.

    I was considering just deleting the post, but I thought if ever someone searches for that OpenGL error code in the forums, they could find this post and at least have something to try. Hope you don't mind me cluttering up the space!
  • edited October 2011
    Not at all! I think you made the right decision.
    As for texture size limit, I don't know the Android ones, but usually 2048 is a safe bet. :)
  • edited November 2011
    .pkm files are ETC1 texture compressed

    It's an attempt to reduce memory bandwidth on Android platform, but performance gains varies from devices... and is not really a big speedup

    If you wanna try ETC1 texture, you need to know that alpha channel can't be encoded in this format, and it only support power of two texture sizes.

    in OrxTest, I made a simple implementation to mix the RGB channels and the G channel from two .pkm to "recreate" an RGBA sprite using a custom shader, but the implementation is sub optimal and i never took the time to fix it... but you get the idea

    you can create .pkm files with etc1tool which comes with Android SDK

    BTW: maximum texture size is 2048x2048
  • edited November 2011
    Gotcha. Didn't know if the warnings about not finding the .pkm files were serious or not...though clearly, the program runs just fine anyway. I think I'll stick to .png's with alpha, myself.

    Thanks for the info!
Sign In or Register to comment.