----- Original Message -----
Sent: Thursday, October 24, 2002 3:58
AM
Subject: Re: [JAVA3D] put a Texture ones
on an object???
(You'll want to use a fixed width font to view
this article)
First, use textures with transparent
backgrounds, and make sure their boundary pixels are
transparent.
Second, use DECAL texture
mode.
Now, for each texture, supply the geometry
with texture coordinates that stretch the
texture's transparent border over those coordinates that you don't
want textured, and stretch the texture over those coordinates that you do want
textured.
If done properly, the textures will not
interfere with each other, and will be positioned properly.
Example:
Consider a TriangleStripArray with 6
coords:
(0)---(2)---(4)
| / |
/ |
| / |
/ |
|
/ | / |
(1)---(3)---(5)
Now suppose we want a texture of a circle to
map to the left rectangle (i.e., the rectangle formed by 0, 1, 2, and 3),
and a texture of a square to map to the right rectangle (i.e., the rectangle
formed by 2, 3, 4, and 5). The texture coordinates you should supply to the
geometry follow.
Circle's corresponding texture
coordinates:
(0,1)-(1,1)-(1,1)
| /
| / |
| / | /
|
|
/ | / |
(0,0)-(1,0)-(1,0)
Square's corresponding texture
coordinates:
(0,1)-(0,1)-(1,1)
| /
| / |
| / | /
|
|
/ | / |
(0,0)-(0,0)-(1,0)
Thus, the circle is mapped to the left
rectangle, and its right edge is stretched across the right rectangle.
Similarly, the square is mapped to the right rectangle, and its left edge is
stretched across the left rectangle. That's why it is important that the edges
of the texture are transparent and you are using DECAL texture
mode.
There are many similar tricks, I leave them to
you to figure out.
Note that each texture is still
being applied across the entire geometry. So, if used unwisely, this
technique could cause a significant performance
problems.
-Stoney
----- Original Message -----
Sent: Wednesday, October 23, 2002 7:53
AM
Subject: [JAVA3D] put a Texture ones on
an object???
Hello out there
does somebody know how to put a texture on an
object, so that the texture is not drawn ower the whole object. I need to
put several textures to thier specified positions on the object. I think
this should be possible?...
At the moment i can only put a texture on an
object, and whatever i do java3d draws this texture many times on that
object, but i just need it on time.
Does someone know a solution for
this?
regards
Martin