[ODE] Help using ODE with DirectX

Duncan Frostick duncanf at f2s.com
Thu Aug 26 21:38:12 MST 2004


Hi, That first version dosn't work, the crash still happens and I don't 
know why, this is what I'm trying now, but it won't compile, see the 
line below:

int numVertices = in->GetNumVertices();
dVector3* verticesODE = (dVector3*)malloc(numVertices*sizeof(dVector3));
Vertex* verticesDX = 0;
in->LockVertexBuffer(0,(void**)&verticesDX);
for (int i = 0; i<numVertices; i++) {
	dVector3 temp;
	temp[0] = verticesDX[i]._x;
	temp[1] = verticesDX[i]._y;
	temp[2] = verticesDX[i]._z;
	temp[3] = 0.0f;
	*verticesODE = temp; //error: '=' : left operand must be l-value
	//can be verticesODE[i] = temp; with omitting of next line
	*(verticesODE++);
}
in->UnlockVertexBuffer();

Any idea why this is illegal? Because I'm lost... this is so frustrating 
for such a simple algorithm... I just don't know what the hell is going 
wrong with it. I know it's got nothing to do with ODE, and I know it's 
got something to do with me messing up the pointers, but without a 
debugger, I'm at a loss to see what's going on. Please someone put me 
out of my misery!

Cheers for your help, Duncan


Kaya Memisoglu wrote:
>>{
>>verticesODE [0] =
>>verticesODE [1] =
>>verticesODE [2] =
>>verticesODE [3] =
>>verticesODE++;
>>}
> 
> This won't work IMO, because verticesODE is a pointer
> to an dVector3 array (each entry consits of 4 floats
> (not 3 as I learnt today)), not a pointer to floats 
> themselves.
> 
> So one should stick to the first version
> 
>>{
>>verticesODE [i] [0] =
>>verticesODE [i] [1] =
>>verticesODE [i] [2] =
>>verticesODE [i] [3] =
>>}
> 
> 
> Kaya
> 
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode



More information about the ODE mailing list