pradeepkalla
pradeepkalla

Reputation: 59

Texture loading

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 to load them inside of ApplicationListener. I have tried accessing texture object outside the scope of OpenGL and failed. Can anyone suggest me on this?

Upvotes: 0

Views: 931

Answers (1)

huff
huff

Reputation: 2014

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.

Upvotes: 1

Related Questions