VBGamer |
|||||||||||||||||||||||||||||||||||||||||||||||||||||
TriangleStrip only visible from underneath ??? WTH Jack Hoxley (2 replies, 0 views) (2000-Jul-22) hi,
Could someone with D3D knowledge help me out. Please.. :)
I'm trying to write a basic landscape engine - at the moment I'm just messing around testing various things out etc...
I want to create a grid of vertices - 10x10 grid for now; and then I want to change the Y value of each one to simulate height. Follow me?
I've been using D3DPT_TRIANGLESTRIP to send the vertices to the pipeline; which has been working fine. I had a single row of triangles that were lit nicely. But they didn't finish as a square - like a rectangle; each end was at an angle - rhombus? I think.... :)
So; I added in a vertice at one end - got a nice squared end, Went to the other end and suddenly nothing appeared on screen. After a while I realise that I can only see the surface from underneath it - or if I rotate it. If I take out this vertex it's fine - but I dont have a squared end.
Basically; could someone point out what I'm doing wrong - and how to fix it...
This is the code I'm using to set up the geometry:
Sub TriangleStrip()
Const Height = -10
Call DX.CreateD3DLVertex(-5, Height, -10, DX.CreateColorRGB(1, 0, 0), 1, 0, 0, LVertexList(12))
Call DX.CreateD3DLVertex(5, Height, -10, DX.CreateColorRGB(1, 0, 0), 1, 0, 0, LVertexList(11))
Call DX.CreateD3DLVertex(-5, Height, -5, DX.CreateColorRGB(Rnd, Rnd, Rnd), 1, 0, 0, LVertexList(10))
Call DX.CreateD3DLVertex(5, Height, 0, DX.CreateColorRGB(Rnd, Rnd, Rnd), 1, 0, 0, LVertexList(9))
Call DX.CreateD3DLVertex(-5, Height, 5, DX.CreateColorRGB(Rnd, Rnd, Rnd), 1, 0, 0, LVertexList(8))
Call DX.CreateD3DLVertex(5, Height, 10, DX.CreateColorRGB(Rnd, Rnd, Rnd), 1, 0, 0, LVertexList(7))
Call DX.CreateD3DLVertex(-5, Height, 15, DX.CreateColorRGB(Rnd, Rnd, Rnd), 1, 0, 0, LVertexList(6))
Call DX.CreateD3DLVertex(5, Height, 20, DX.CreateColorRGB(Rnd, Rnd, Rnd), 1, 0, 0, LVertexList(5))
Call DX.CreateD3DLVertex(-5, Height, 25, DX.CreateColorRGB(Rnd, Rnd, Rnd), 1, 0, 0, LVertexList(4))
Call DX.CreateD3DLVertex(5, Height, 30, DX.CreateColorRGB(Rnd, Rnd, Rnd), 1, 0, 0, LVertexList(3))
Call DX.CreateD3DLVertex(-5, Height, 35, DX.CreateColorRGB(1, 1, 1), 1, 0, 0, LVertexList(2))
'It's this Vertex here that screws everything up
Call DX.CreateD3DLVertex(5, Height, 25, DX.CreateColorRGB(1, 0, 1), 1, 0, 0, LVertexList(1))
CubeScale = MakeVector(1, 1, 1)
End Sub
Then I use this line to render it:
Call Device.DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_LVERTEX, LVertexList(1), 12, D3DDP_DEFAULT)
If you're wondering why I'm using D3DLVERTEX - it's because I want to write my own lighting engine - so I dont want to use TLVERTEX or VERTEX...
Thanks for any help [in advance]
Jack.
|