Re: attach texture to a cube.
From: Callum Winter (callum_at_REMOVE_THISwinter9999.fsnet.co.uk)
Date: 04/03/04
- Next message: Callum Winter: "Re: Model Normal\Crease Problems"
- Previous message: whisper: "3D presentation"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 3 Apr 2004 13:22:22 +0100
To do this accurately you will need to split the cube into 6 subsets(sides),
then set each texture between rendering each one.
Also note if your cube only has 8 vertices you will need 2 texture coords
per vertex or 2 of the sides wont get mapped properly due to the texture
coords being incorrect at some vertices as they were used by another side.
either this or you can create your cube with 4 vertices per side, then each
one only needs 1 texture coord.
Depends which is most comfortable for you and what the needs of the
application are, but if its only a cube with textures it wont hurt to define
24 instead of 8 vertices for it, with 1 tex coord set, and this would be
simpler to texture.
The tex coords for each vertex will then be. Top left (0, 0), Top Right
(1,0), Bottom Left (0, 1), Bottom Right (1, 1).
To map the texture just call Device->SetTexture before rendering each side.
Direct x then uses the tex coords you set and applies the texture for you
when its rendered.
Hope this helps.
Callum.
"Richard Zhu" <yzhu@algis.ca> wrote in message
news:106gqmvsr1n70e5@corp.supernews.com...
> I have 6 textures, want to attach to a cube.x object, after loading the x
> file, how to get the vetex coordinate ? and attach each texture to each
> surface, any examples ? the question may be too simple, I really saw it
> before, but now forget how to ,
> thanks guys.
>
>
- Next message: Callum Winter: "Re: Model Normal\Crease Problems"
- Previous message: whisper: "3D presentation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|