Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGLES版本中的TMX地图变成白色图块的问题 #6

Open
himno opened this issue Sep 6, 2013 · 0 comments
Open

OpenGLES版本中的TMX地图变成白色图块的问题 #6

himno opened this issue Sep 6, 2013 · 0 comments

Comments

@himno
Copy link

himno commented Sep 6, 2013

TMXTiledMap map;
public void onLoad() {
//加载TMX地图,XML中图片加载路径在assets文件夹下
map = new TMXTiledMap("assets/desert.tmx","assets");
}
public void draw(GLEx g) {
//当onLoad中资源全部加载完毕时
if (isOnLoadComplete()) {
//绘制TMX地图到屏幕,由TMX坐标的1,5位置开始显示(换算为像素坐标就是1_tileWidth,5_tileHeight)
map.draw(g,1,5);
}
}

按照这个方法,画出来的地图没有纹理,全是白色方块。这个问题只出现在opengles版本引擎上。
根据我的排察验证,gles版本引擎如果在onLoad方法中使用了loadTexture方法,那么载入的图片就会变成一片白色,具体原因不知。
如上面的代码,如果把map的初始化放到 draw方法里,就能正常显示。
@cping 大神到底会不会看这里的信息啊!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant