nicolasgramlich/AndEngine — Issue #21: Black Sprites?
Author: JFixbi
Created: 2012-01-28 13:04:49+00:00
State: open

Hi
I'm using the latest GLES2 (now it is the 28 January)

I'm building very simple scene with one sprite attached.

Here is an example sprite file:

[img]http://jfixbi.files.wordpress.com/2012/01/magic.png[/img]

And here is what I actually see when I run the app:

[img]http://jfixbi.files.wordpress.com/2012/01/sc20120128-133820.png[/img]

It keeps happening to all images I use for the sprite.

What is wrong?

Here is the full app code:

[syntax="java"]package test.test;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.EngineOptions.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.entity.sprite.Sprite;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.ui.activity.SimpleBaseGameActivity;
import org.andengine.util.debug.Debug;

public class Test3Activity extends SimpleBaseGameActivity {

BitmapTextureAtlas textureAtlas;
ITextureRegion texture;
Sprite sprite;

@Override
protected void onCreateResources() {
// TODO Auto-generated method stub

Debug.w("onCreateResources()");

BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("1/");

textureAtlas = (new BitmapTextureAtlas(1024, 1024,
TextureOptions.BILINEAR));

texture = (BitmapTextureAtlasTextureRegionFactory.createFromAsset(
textureAtlas, this, "magic.png", 0, 0));

sprite = (new Sprite(10, 10, texture,
this.getVertexBufferObjectManager()));

s.attachChild(sprite);

}

@Override
protected Scene onCreateScene() {
Debug.w("onCreateScene()");

s.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
return s;
}

public static final int GAME_CAMERA_WIDTH = 800;
public static final int GAME_CAMERA_HEIGHT = 480;

public static final Camera gameCamera = new Camera(0, 0, GAME_CAMERA_WIDTH,
GAME_CAMERA_HEIGHT);

public static final EngineOptions gameEngineOptions = new EngineOptions(
true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(
GAME_CAMERA_WIDTH, GAME_CAMERA_HEIGHT), gameCamera);

Scene s = new Scene();

@Override
public EngineOptions onCreateEngineOptions() {
// TODO Auto-generated method stub
return gameEngineOptions;
}

}[/syntax]