1
\$\begingroup\$

I want to animate a Sprite in Andengine , I have used the following

this.mSnapdragonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this,"arrow.png", 10, 10);

As show above in code its array is 10x10 that means I have 100 images to be animated, here is the image (I had individual image and joined it online so I created image below):

input

My issue is if I place this code and image it show black patch instead of animated image, i hv tried with 2x3, 4x2 animated sprite that is > working fine . Is my issue because of 10x10 ? what is the max row and col I can place to animate a Sprite in Above Code

Here is my output :

output

\$\endgroup\$
2
  • \$\begingroup\$ what is the size of the whole texture, in pixels ? \$\endgroup\$
    – Raxvan
    Commented Nov 29, 2013 at 12:06
  • \$\begingroup\$ single images is 280x280 \$\endgroup\$
    – KOTIOS
    Commented Nov 29, 2013 at 12:11

1 Answer 1

1
\$\begingroup\$

Hi MT8 and thanks for your question.

I am not familiar with the AndEngine but I recognized some issues that are typically for this problem.

Normally you get no limit cap by the number of division. These are just passed parameters to the graphics pipeline where to get the specific tile from in the image(texture).

One thing that can cause the problem is the size of your image. Graphic cards have a hardware specific maximum and minimum value. In order to get more tiles with the same size in pixels you have to increase the size of your texture. The texture you posted is huge in size and most mobile graphic chip can not handle it.

So what to do? First check your limitations. Since you are using an Android Engine I assume you are using OpenGLES. You can get the max dimension by:

GLint maxDimension;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, maxDimension, 0);

If this is the problem you have multiple choices. First reduce the size of every tile.

Second use a tile format to squeeze out your white spaces. You can find a nice video here.

Split your tiles in multiple textures. Anyway you are limited to your number of texture channels.

Additionally your image has no squared size to a number of 2^n. This leaks memory and slows down your rendering pipeline. Even if you do not use the space you should resize your image.

I hope I could help you. Have further questions? please tell us. :)

Michael

\$\endgroup\$
11
  • \$\begingroup\$ ok let me try first what hv u mention . i will get back soon thanks for answer \$\endgroup\$
    – KOTIOS
    Commented Nov 29, 2013 at 11:48
  • \$\begingroup\$ plz check my edited answer, i tried what u said \$\endgroup\$
    – KOTIOS
    Commented Nov 29, 2013 at 12:01
  • \$\begingroup\$ i can only see a new screenshot with the black part but what is your output if maximum texture size did you reduce the dimension of your texture and set it equal? Meanwhile i will lookup the implementation of the tile set in AndEngine \$\endgroup\$
    – NjamNjam
    Commented Nov 29, 2013 at 12:06
  • \$\begingroup\$ each image is of 280x280 i hv combile that to whole as shown above which is 100 images \$\endgroup\$
    – KOTIOS
    Commented Nov 29, 2013 at 12:08
  • \$\begingroup\$ the engine itself calculates the texture coordinates for each tile by splitting the hole image in uniform lengths. So this should not be the reason. But my question did you check your hardware maximum texture size?, because i am pretty sure this causes the problem. May just scale down your image to 1024:1024. In this case you will loose your format and level of detail but test against it \$\endgroup\$
    – NjamNjam
    Commented Nov 29, 2013 at 12:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .