Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

12045 Posts in 1593 Topics- by 593 Members - Latest Member: zhang

19. June 2013, 09:58:21 am
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Textures with same name
Pages: [1]
Print
Author Topic: Textures with same name  (Read 535 times)
maguila007
Enjoying the stay
*
Offline Offline

Posts: 43



View Profile Email
« on: 26. November 2008, 02:28:05 pm »

I want to have different texture's folders.
If I have two textures with the same name in different folders, which one will be loaded by the TextureLoader?

Example: test.jpg is in both folders textures1 and textures2.
Code:
ResourceLocator resLoc = ResourceLocator.create( "res/" );
resLoc.createAndAddTSL( "textures1" );
resLoc.createAndAddTSL( "textures2" );

Texture texture = TextureLoader.getInstance().getTexture( "test.jpg" );
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #1 on: 26. November 2008, 06:50:14 pm »

The TextureLoader will first search the "textures1" folder (first added to the loader) and then proceed with the second one "textures2". It will load the first found occurrence.

I suggest to do the following:

Folder hierarchy:
org/mygamename/resources/textures/texpak1/
org/mygamename/resources/textures/texpak2/
org/mygamename/resources/textures/texpak3/

Initialization code:
Code:
ResourceLocator resLoc = ResourceLocator.create( "org/mygamename/resources/" );
resLoc.createAndAddTSL( "textures" );

Loading code:
Code:
Texture2D texture = TextureLoader.getInstance().getTexture( "texpak1/test.jpg" );

This way there won't be any conflicts.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic