Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: NevilleKemp

26. May 2012, 07:13:19 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Rectangle setTexture, does not work
Pages: [1]
Print
Author Topic: Rectangle setTexture, does not work  (Read 862 times)
Dori
Enjoying the stay
*
Offline Offline

Posts: 90


View Profile
« on: 20. February 2007, 10:34:20 pm »

Hi, I found a bug at Rectangle.
When I create rectangle and use setTexture(texture) the result is ether just fill white or nothing at all. But if put the texture in the constructor it works as expected. I plan to use different texture depending on state of the unit so this is a problem.
Thanks.

P.S the same white rect just fills the rectangle if I set the texture in a Appearance and then apply the appearance to the rectangle.
« Last Edit: 20. February 2007, 10:51:18 pm by Dori » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 20. February 2007, 11:03:12 pm »

Hi, I found a bug at Rectangle.
When I create rectangle and use setTexture(texture) the result is ether just fill white or nothing at all. But if put the texture in the constructor it works as expected. I plan to use different texture depending on state of the unit so this is a problem.
Thanks.

P.S the same white rect just fills the rectangle if I set the texture in a Appearance and then apply the appearance to the rectangle.

You can only change the Texture through setTexture() when the constructor got a Texture. If you don't know the initial Texture a construction time, just do the following:

Code:
Rectangle rect = new Rectangle( TextureLoader.getFallbackTexture(), ... );

The reason is, that the Geometry needs texture coordinates, which are only created, when it is told to.

Hope, that helps.

Marvin

Logged
Dori
Enjoying the stay
*
Offline Offline

Posts: 90


View Profile
« Reply #2 on: 20. February 2007, 11:07:32 pm »

Ok, thanks a lot! I wasn't sure if it was a bug or not, I figure that setTexture would do the same as set the texture in the constructor. It works now.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic