VBGamer |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
More TLVERTEX issues. PyroBoy (11 replies, 0 views) (2000-Sep-14) I've got TLVERTEXs displaying now. Thanks to those who answered my last post about it! :-)
Now, I have a new problem. I can't get it to texture... Once again, I'm just drawing a square, and I want to put a texture on it. Here's my whole vertex init:
Dim Vertices(0 To 3) as D3DTLVERTEX
Private Indices(0 To 5) As Integer
'Top-Left
With Vertices(0)
.sx = 400
.sy = 300
.sz = 0
.rhw = 1
.Color = DXObjectHandle.CreateColorRGBA(128, 128, 128, 1)
.tu = 0
.tv = 0
End With
'Top-Right
With Vertices(1)
.sx = 500
.sy = 300
.sz = 0
.rhw = 1
.Color = DXObjectHandle.CreateColorRGBA(128, 128, 128, 1)
.tu = 1
.tv = 0
End With
'Bottom-Left
With Vertices(2)
.sx = 400
.sy = 400
.sz = 0
.rhw = 1
.Color = DXObjectHandle.CreateColorRGBA(128, 128, 128, 1)
.tu = 0
.tv = 1
End With
'Bottom-Right
With Vertices(3)
.sx = 500
.sy = 400
.sz = 0
.rhw = 1
.Color = DXObjectHandle.CreateColorRGBA(128, 128, 128, 1)
.tu = 1
.tv = 1
End With
'Set up indices
Indices(0) = 0
Indices(1) = 1
Indices(2) = 2
Indices(3) = 2
Indices(4) = 1
Indices(5) = 3
So, as you can see, it's just a simple square sitting near the centre of an 800x600 screen. When I render it with no texture, I get the expected grey square. When I render it with a texture, I get the same grey square. When I use a texture with a colorkey, the transparent areas are excluded, as expected, but the areas to be drawn are still that flat grey color...
It's got nothing to do with the texture map, because I rendered some other (non-TLVERTEX) objects with it and they worked fine, and the TLVERTEX square didn't work with any of the other textures I have loaded.
Here's my rendering code:
'Set colorkeying
RenderingDeviceHandle.SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, True)
'Apply texture to renderer
Call RenderingDeviceHandle.SetTexture(0, TextureMap)
'Render
Call RenderingDeviceHandle.DrawIndexedPrimitive(D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, Vertices(0), 4, Indices(), 6, D3DDP_DEFAULT)
Why won't the texture show up??
|