Re: Rendering Texture on Mesh.XXXX
From: Daniel Yankowsky (dyankowsky_at_verizon.net)
Date: 07/15/04
- Next message: Daniel Yankowsky: "Re: stop texture from interpolating"
- Previous message: Daniel Yankowsky: "Re: managed alpha channel texture"
- In reply to: rond: "Rendering Texture on Mesh.XXXX"
- Next in thread: rond: "RE: Rendering Texture on Mesh.XXXX"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 15 Jul 2004 01:02:23 GMT
Nothing like the blind leading the blind, but I'll take a stab at this. I'm
kinda new to DirectX as well. If indeed your torus has no texture
coordinates, then I think that you will need to create a new vertex buffer
for your mesh. This vertex buffer must contain vertices of a type that
includes texture coordinates. Thus, when you create the vertex buffer, I
think you need to OR in VertexFormats.Texture1 or greater. Then, you need
to lock both buffers and copy from one to the other, calculating texture
coordinates as you go. Once done with that, you should be able to unlock
and render as your code below indicates.
If you want to play with textures, maybe it would be easier to write a .x
file and load it. It's easy: Mesh m = Mesh.FromFile(params). Then, you can
specify tex coords very easily. Just make a nice, flat square. 4 vertices,
4 tex coords.
"rond" <rond@discussions.microsoft.com> wrote in message
news:BECFD90D-5243-488C-911E-62D59BE0C676@microsoft.com...
> Hi,
>
> I'm evaluating Managed DirectX and have a simple task (or so I thought).
>
> I want to apply the banana.bmp to a torus created with Mesh.Torus.
>
> I have the Torus rendering, it is being drawn as a solid color, it appears
that it is being drawn with a color in the banana.bmp but the actual texture
is not being rendered on the torus. I'm not fussy on how the bitmap is
applied to the torus, only that it is applied.
>
> I have read that Meshes created with Mesh.Torus have no texture
coordinates set; I assume this is what I need to do. How would one go about
setting texture coordinates on a mesh created with Mesh.Torus?
>
> My current logic is basically like this.
>
> Mesh mesh = Mesh.Torus(device,_r1,_r2,_sides,_rings);
> texture = TextureLoader.FromFile(device,strTempFile);
> _device.SetTexture(0, texture);
> _drawMesh.DrawSubset(0);
>
> Ideas?
>
> Thanks
>
- Next message: Daniel Yankowsky: "Re: stop texture from interpolating"
- Previous message: Daniel Yankowsky: "Re: managed alpha channel texture"
- In reply to: rond: "Rendering Texture on Mesh.XXXX"
- Next in thread: rond: "RE: Rendering Texture on Mesh.XXXX"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|