D3D7 -> WineD3D, 2nd attempt

Oliver Stieber oliver_stieber at yahoo.co.uk
Sun Oct 16 10:43:09 CDT 2005


--- Stefan Dösinger <stefandoesinger at gmx.at> wrote:

> Hello,
> > I think the best thing to do is to create another function in
> > wined3d/device.c DrawIndexedPrimitiveVB that is based on
> > DrawIndexedPrimitiveUP but either takes a IWineD3DVertexBuffer or has the
> > caller use SetVertexBuffer and then call DrawIndexedPrimitiveVB .
> >
> > e.g.
> <snip>
> > IWineD3DDeviceImpl_DrawIndexedPrimitiveVB(IWineD3DDevice *iface,
> > D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices,
> > CONST void* pIndexData,
> >                                           IWineD3DVertexBuffer*
> > pVertexBuffer, UINT dwStartVertex, UINT Stride) {
> >
> >     IWineD3DDeviceImpl_SetStreamSource(device, 0, pVertexBuffer, 
> > dwStartVertex * Stride, Stride); /* The rest of the code making up
> > IWineD3DDeviceImpl_DrawIndexedPrimitiveVB */ }
> I have hit this function again with half-life. What is this Stride here? I 
> haven't found anything usefull about it.
Vertex buffers hold arrays of vertex (and possibly other) data, the stride is the size of the
vertex + data stucture in bytes.

So,

struct vertexData {
   D3DVALUE x, y, x; /* vertixes 
   D3DVALUE nx, ny, nz;  /* normals 
   D3DVALUE tu, tv;      /* texture offsets 
};

struct vertexData myVertexData[5];

int main(int argv, char *argc) {
    char *vertexData = (char *)myVertexData;
    int stride = sizeof(struct vertexData);

    if ((void *)(&myVertexData[2]) == (void *)(vertexData + (2 * stride))) {
        printf("Success\n");
    }
}


You'll have to use the FVF of the vertex buffer's D3DVERTEXBUFFERDESC to work out it's stride
size.

Oliver.

> 
> Stefan
> 



		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com



More information about the wine-devel mailing list