Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11855 Posts in 1569 Topics- by 3045 Members - Latest Member: lensreslai

10. February 2012, 05:09:31 AM
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)A (possible) bug in the TielMode for background Texture
Pages: [1] 2
Print
Author Topic: A (possible) bug in the TielMode for background Texture  (Read 906 times)
roslamir
Enjoying the stay
*
Offline Offline

Posts: 50



View Profile
« on: 03. August 2009, 04:58:42 AM »

The code
Code:
mainMenuDialog.getContentPane().setBackgroundTexture("mainmenu_background.png", TileMode.TILE_BOTH);
produced a tiled background image.

But the equivalent code
Code:
Texture2D texture1 = (Texture2D) ResBag.getTexture(RES_TEXTURE_MAINMENU_BACKGROUND);
mainMenuDialog.getContentPane().setBackgroundTexture(texture1, TileMode.TILE_BOTH);
produced a stretched background image.

Any ideas?

Roslan
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #1 on: 03. August 2009, 05:59:38 PM »

Load the texture through the utility method
Code:
org.xith3d.ui.hud.utils.HUDTextureUtils.getTexture()
and you'll be fine.

Marvin
Logged
roslamir
Enjoying the stay
*
Offline Offline

Posts: 50



View Profile
« Reply #2 on: 04. August 2009, 07:16:38 AM »

Thanks, Marvin.
Logged
roslamir
Enjoying the stay
*
Offline Offline

Posts: 50



View Profile
« Reply #3 on: 04. August 2009, 03:48:33 PM »

In fact, if this is the recommended way, why don't we put this information in the XIN? I learned about the ResBag from it.

I can help you update the XIN, if you like. I've written technical manuals before in my day job.

Roslan
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #4 on: 04. August 2009, 05:32:11 PM »

In fact, if this is the recommended way, why don't we put this information in the XIN? I learned about the ResBag from it.

I can help you update the XIN, if you like. I've written technical manuals before in my day job.

Please fell free to update the document. I am happy for any help.

Marvin
Logged
roslamir
Enjoying the stay
*
Offline Offline

Posts: 50



View Profile
« Reply #5 on: 05. August 2009, 01:19:08 AM »

OK. I will. A few questions first.

Is the String tetxureName relative to the resource directory as specified like this:
Code:
ResourceLocator resLoc = ResourceLocator.create("resources/");
resLoc.useAsSingletonInstance();
resLoc.createAndAddTSL("textures");

or we can specify the absolute path as in "/<path>/resources/textures/background.png"? Or even a URL string?

I use the first way and org.xith3d.ui.hud.utils.HUDTextureUtils.getTexture(java.lang.String textureName, boolean useCache) works like a charm.

Roslan
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #6 on: 05. August 2009, 09:47:03 AM »

The HUDTextureUtils.getTexture() method is simply a wrapper for the org.xith3d.loaders.texture.TextureLoader.getTexture() method. So all rules also apply here. This also means, that this name is a resource name, that is searched in all the TextureStreamLocators, added to the TextureLoader (which you're doing through the helper method in ResourceLocator) Smiley.

Marvin
Logged
roslamir
Enjoying the stay
*
Offline Offline

Posts: 50



View Profile
« Reply #7 on: 06. August 2009, 01:57:40 AM »

Thanks. I'm updating the Javadoc comments for HUDTextureUtils and will send to you for checking and putting into the SVN source.

Roslan
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #8 on: 06. August 2009, 08:08:15 PM »

Thanks. I'm updating the Javadoc comments for HUDTextureUtils and will send to you for checking and putting into the SVN source.

You may want to send me your sourceforce account name, so that I can grant you dev access. This way it is a lot simpler for you and also for me.

Marvin
Logged
roslamir
Enjoying the stay
*
Offline Offline

Posts: 50



View Profile
« Reply #9 on: 07. August 2009, 01:23:15 AM »

OK. Sourceforge account name is roslamir.

Roslan
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #10 on: 07. August 2009, 10:59:45 AM »

I have granted you dev access on the xith3d, xith-tk and jagatoo projects.

Marvin
Logged
roslamir
Enjoying the stay
*
Offline Offline

Posts: 50



View Profile
« Reply #11 on: 08. August 2009, 03:50:50 PM »

Thanks. I have never had a developer access on any project before.

So how do I go about updating, say, the Javadoc comments of a class?

Make changes on my copy of the source, then do a SVN commit?

Roslan
Logged
roslamir
Enjoying the stay
*
Offline Offline

Posts: 50



View Profile
« Reply #12 on: 08. August 2009, 04:43:55 PM »

OK. That's what I did and it worked. BTW, I updated the Javadoc for HUDTextureUtils.

Roslan
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #13 on: 08. August 2009, 04:50:49 PM »

Great work. Thanks a lot.

For the future:

1. Please don't apply a formatter to the code. It will always change more than it should. In this case you converted all the spaces to tabs and removed the spaces between parentheses. This leads to changes in each single line.

2. You should better not use Team->Commit, but Team->Synchronize. This way you can check, what changed and even compare the changeed files with the original version. Then you will see, if there are unwanted changes.

Marvin
Logged
roslamir
Enjoying the stay
*
Offline Offline

Posts: 50



View Profile
« Reply #14 on: 08. August 2009, 06:39:16 PM »

Sorry. That was a mistake. I applied the formatter before I even made any changes. So I could understand the code. I know not to reformat from now on.

Actually I don't use Subclipse (spelling?). I use TortoiseSVN. It does show me all the changed files. But I selected only the actual file affected.

Roslan
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic