Graphics not being displayed (OpenGL ES 2.0 + LibGDX spritebatch)

I am using LibGDX as my framework for my game and launching the Android backend on the OUYA. Everything seems fine except that none of my graphics are being displayed! I can only tell what's going on because of Box2D's DebugDraw showing my physics. I am using LibGdx's spritebatch and OGLES 2.0.

Am I doing something wrong with handling my resources for OUYA? What could be the problem?

Comments

  • Amplify91Amplify91 Posts: 14Member
    Could this be because I store my graphics in the assets folder instead of /res?
  • mjoynermjoyner Posts: 168Member
    Is it working properly as a desktop app or on a tablet?
  • Amplify91Amplify91 Posts: 14Member
    Yes, it works fine on desktop and also on an Android phone.
  • mjoynermjoyner Posts: 168Member
    I would create a new test app that simply displays an image as a starting point.
  • Amplify91Amplify91 Posts: 14Member
    here's a logcat output: http://pastebin.com/BbPyPCcR
  • Amplify91Amplify91 Posts: 14Member
    Can anybody help me with this? I am getting no errors and the rest of my game runs fine, it just doesn't display my textures. I"m stuck and I would like to be able to release a video of my game running on the OUYA.
  • mjoynermjoyner Posts: 168Member
    edited January 2013
    Logcat didn't clue me to anything.

    Did you create a simple test app? If yes, did it work or did it fail the same way?

    Are you using mipmaps?

    Are you using a "nightly" or version 0.9.7? Tried switching between them?

    I don't have an OUYA yet, so can't many suggestions beyond that. But, I had missing textures once on a Windows box because of GL compatibility issues.
    Post edited by mjoyner on
  • SueseSuese Posts: 120Member
    OH, I thought this was just me. I couldn't seem to get OpenGL ES 2 to display anything either. I thought I was just doing something wrong.
    TheSuese.com - Elite Developer Backer
  • Amplify91Amplify91 Posts: 14Member
    No simple test app, that would take a lot of time and effort to setup with similar conditions as my app. No mipmaps, version 0.9.6. Suese! Stay in touch here, let me know if you find something and I will do the same. Perhaps I will try upgrading to 0.9.7.
  • SueseSuese Posts: 120Member
    edited January 2013
    @Amplify91 I've got Stage3D with Adobe AIR running great. I'm not interested in using Java at all any more since I am MUCH more familiar with Action Script 3. If you want instructions on how to get started with FlashDevelop go to http://forums.ouya.tv/discussion/158/flashdevelop-adobe-air-i-can-breathe

    I will post instructions on how to get debugging working very soon.
    Post edited by Suese on
    TheSuese.com - Elite Developer Backer
  • DelpeeDelpee Posts: 120Member
    Amplify91 said:

    No simple test app, that would take a lot of time and effort to setup with similar conditions as my app...

    I think mjoyner meanth just running a basic android application on the system (an "empty" project). Even though it won't do the same as you want your app to behave it could show the experts here where the problem lies within your application!

    Delpee
    ~ Yuri van Geffen (Portfolio)
  • Amplify91Amplify91 Posts: 14Member
    Delpee said:

    Amplify91 said:

    No simple test app, that would take a lot of time and effort to setup with similar conditions as my app...

    I think mjoyner meanth just running a basic android application on the system (an "empty" project). Even though it won't do the same as you want your app to behave it could show the experts here where the problem lies within your application!

    Delpee
    I realize what he meant, but even an "empty" project that did nothing but display a graphic using my framework and engine would be about 20 hours of work I don't have time for. I believe the problem is some kind of OpenGL error. The logcat info I posted mentions something about drivers not being found. I just can't seem to figure that out.
  • mjoynermjoyner Posts: 168Member
    You might need to post on the libgdx forums as well. But, isn't it possible just to create a simple GL2 app that just displays a single GL2 sprite or actor as a starting point?
  • theaceofthespadetheaceofthespade Posts: 21Member
    Did you ever figure this out?   If not, were you loading in images stored in the res folder?
  • Amplify91Amplify91 Posts: 14Member
    theaceofthespade said:
    Did you ever figure this out?   If not, were you loading in images stored in the res folder?
    No, I still have not been able to figure this out. I stored my graphics in the assets folder not the res folder. I use Gdx.files.internal("my_graphic.png") to access them. This works fine on desktop and Android but not the OUYA. I don't see why using the assets folder would work on Android but not OUYA. I'm still open to ideas.
  • mjoynermjoyner Posts: 168Member
    texture atlas size?
  • badlogicbadlogic Posts: 23Member
    edited January 2013
    Zip your project and send it to me. Otherwise you'll need to give us more info. Texture size, drawing method, some code. Whatever you can throw at us. My guess would be texture size, or a custom shader that's wonky.

    Our entire test suites running fine on Ouya, so do the demo games and many third party games. We'll figure this one out :)
    Post edited by badlogic on
  • Amplify91Amplify91 Posts: 14Member
    badlogic said:
    Zip your project and send it to me. Otherwise you'll need to give us more info. Texture size, drawing method, some code. Whatever you can throw at us. My guess would be texture size, or a custom shader that's wonky.

    Our entire test suites running fine on Ouya, so do the demo games and many third party games. We'll figure this one out :)
    Mario! I'm honored that you're helping me :) My spritesheet is extremely large (4096x4096) but I would think the Tegra3 could handle it since my less powerful phone can. I'm also not using custom shaders, just the default.

    You can grab the code from my Github: https://github.com/amplify91/RAW-Gdx
    And the Android backend: https://github.com/amplify91/RAW-Gdx-android
  • noctnoct Posts: 122Member
    @Amplify91 Tegra3 supports a max of 2048x2048; different GPUs have different limitations.
  • mjoynermjoyner Posts: 168Member
    Repack your atlas to 2048x2048 and try it again...

    And if you are releasing to other devices, you probably will need to check the reported max texture size:

    IntBuffer buf = BufferUtils.newIntBuffer(16);
    Gdx.gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, buf);
    int maxSize = buf.get();
  • Amplify91Amplify91 Posts: 14Member
    mjoyner said:
    Repack your atlas to 2048x2048 and try it again...

    And if you are releasing to other devices, you probably will need to check the reported max texture size:

    IntBuffer buf = BufferUtils.newIntBuffer(16);
    Gdx.gl.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, buf);
    int maxSize = buf.get();
    This was something I was planning on doing before release but didnt see a reason to do yet. Thats disappointing about the Tegra3 since it means my resources will look even worse now that they are on a huge screen and half the resolution. Thank you for your help, I will post an update when I've got it working to make sure that was the problem.
  • badlogicbadlogic Posts: 23Member
    GL_MAX_TEXTURE_SIZE is really only a best estimate, and you shouldn't rely on it. In any case, your texture size is likely the problem, i'll give your project a spin this weekend. In the meantime repack your textures and report back whether that worked.
  • ZeroDependencyZeroDependency Posts: 27Member
    @amplify91 Could you not split your atlas into 2x 2048x2048 textures rather than a single 4096x4096? I appreciate this will result in a texture unit switch (unless you keep both bound in separate units, and your shaders accommodate this).
    image
  • Amplify91Amplify91 Posts: 14Member
    Well I changed my spritesheet to 2048x2048 and it is still not working. I even tried all the way down to 64x64 to be safe, but it still doesn't show any textures.
  • badlogicbadlogic Posts: 23Member
    Got some time to look into it. First of all, 4096x4096 won't work on most Android devices, including the Tegra 3. That doesn't mean you need to sacrifice anything, just pack your sprites/tiles into more sprite sheets.

    Next, i went through your code. To my surprise i found that you duplicated a lot of functionality that's already in libgdx, e.g. SpriteSheet vs TextureAtlas and so on. It appears your sprites are packed manually, with offsets define in code. Consider using TextureAtlas and the TexturePacker, they will result in a lot better packing (most of your current atlas is empty or unused).

    I resized your atlas to 2048x2048, the Tegra 3 can't handle 4kx4k textures. Of course, your hardcoded offsets don't work with that anymore, so nothing shows up. I augmented MenuManager like this http://pastebin.com/zvzRMCdb

    i basically load the downsized texture into a field, then use SpriteBatch to draw. Notice that i reset the SpriteBatch projection matrix to use pixel coordinates. I could not figure out why you'd use MKS units for your UI, much less why you'd use Box2DDebugRenderer for debug drawing, but that's not for me to judge :)

    The result of this little operation looks like this: http://i.imgur.com/ckLFe.png I only show part of the full 1080p image. As you can see, your textures display just fine.

    Your tests with downsizing the texture atlas have likely failed because your hard coded offsets for tiles and images are wrong if the image size changes. You have a lot of empty space in your sprite sheet, so changes are you hit and empty area with your offsets, and hence nothing is displayed. If you fix your offsets for the new texture size, things should work fine. I spent quite a bit of time setting up the project and debugging your code, so i hope it's OK that i leave fixing this to you. You know your way around your code a lot better than me :)

    I highly recommend rethinking the following:
    hth,
    Mario

Sign In or Register to comment.