Sorry for the assault of new topics, I figure it is better to keep them separate.
I believe the cause of my screen artifacts from this thread [url=“http://forums.nvidia.com/index.php?showtopic=83921”]http://forums.nvidia.com/index.php?showtopic=83921[/url] is the following
I am performing collision detection on polygon meshes but my problem comes when I try and write the results to a 2D integer array that has been “flattened” I think that I am doing this wrong because it only works when the meshes have the same size.
this is in my kernel function:
const unsigned int tix = blockIdx.xblockDim.x + threadIdx.x;
const unsigned int tiy = blockIdx.yblockDim.y + threadIdx.y;
for(i=0;i<3;i++)
{
//get the coords of each vertex for each tri
V0[i] = (float)( m1[9tix+i] + t1[i]);
V1[i] = (float)( m1[9tix+3+i] + t1[i]);
V2[i] = (float)( m1[9*tix+6+i] + t1[i]);
U0[i] = (float)( m2[9*tiy+i] + t2[i]);
U1[i] = (float)( m2[9*tiy+3+i] + t2[i]);
U2[i] = (float)( m2[9*tiy+6+i] + t2[i]);
}
int result = cudaCollide(V0,V1,V2,U0,U1,U2);
results[s1*tix+tiy] = result; //s1 is the number of triangles in mesh1
anyway it crashes my program if I use 2 different size meshes and gives me strange screen artifacts if I put in meshes that are to big.
I have a hard time diagnosing this problem since it works on meshes that are the same size. and it is getting a little frustrating rebooting every time I try something different because my screen starts melting… I figure the last line is part of the problem because if I comment it out I don’t get the screen artifacts, even though it still crashes.
any ideas are appreciated.
Thanks