okies, the code:
Code:
void settriangles()
{
float tessellate[12][6]={0};
int copydata=0, trip=0, count;
for(count=0; count<13; count++)
{
if(print[count][S]==1)
{
tessellate[count][X]=print[count][X];
tessellate[count][Y]=print[count][Y];
tessellate[count][R]=print[count][R];
tessellate[count][G]=print[count][G];
tessellate[count][B]=print[count][B];
copydata++;
}
}
copydata-=3;
for(count=0; count<=copydata; count++)
{
trip++;
triangle[trip][X1]=tessellate[0][X];
triangle[trip][Y1]=tessellate[0][Y];
triangle[trip][R1]=tessellate[0][R];
triangle[trip][G1]=tessellate[0][G];
triangle[trip][B1]=tessellate[0][B];
triangle[trip][X2]=tessellate[count+1][X];
triangle[trip][Y2]=tessellate[count+1][Y];
triangle[trip][R2]=tessellate[count+1][R];
triangle[trip][G2]=tessellate[count+1][G];
triangle[trip][B2]=tessellate[count+1][B];
triangle[trip][X3]=tessellate[count+2][X];
triangle[trip][Y3]=tessellate[count+2][Y];
triangle[trip][R3]=tessellate[count+2][R];
triangle[trip][G3]=tessellate[count+2][G];
triangle[trip][B3]=tessellate[count+2][B];
}
printf("\nPre Split\n");
for(count=0; count<=copydata; count++)
{
if(triangle[count][Y1]!=triangle[count][Y2] || triangle[count][Y2]!=triangle[count][Y3])
{
trip++;
printf("\nSplitTriangles called\n");
splittriangle(count, trip);
}
}
printf("\nLeaving SetTriangles\n");
return;
}
thats the function, when ran it goes as far as printing "Leaving.." etc then when it returns to the main, it has a segmentation fault
[code][/code]tagged by Salem