开发者

Texture loading

开发者 https://www.devze.com 2023-04-06 18:25 出处:网络
I am using libgdx and I am loading all my textures as shown below, Texture objTexture=new Texture(Gdx.files.internal(\"imagename\"));

I am using libgdx and I am loading all my textures as shown below,

Texture objTexture=new Texture(Gdx.files.internal("imagename"));

This code was inside my ApplicationListener. But, I want to load all my images at the start of my game. I don't want 开发者_StackOverflowto load them inside of ApplicationListener. I have tried accessing texture object outside the scope of OpenGL and failed. Can anyone suggest me on this?


I think that the soonest you can load those textures (it involves uploading them into the VRAM, so I guess that the Graphics module has to be initialized and all the GL stuff done) is in the create function of the ApplicationListener.

Also, you may consider using the new AssetManager to manage your resources. Or write a simpler asset manager.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号