c - Reading pointer data -
i'm using library has opengl syntax. when using function data pointer, brings in first cells irrelevant numbers.
int *rindices = (int*)malloc(icount * 500* sizeof(int)); gigetindexedmesh(&vcount, &icount, rindices); (int j = 0; j < icount; j += 3) { printf("%d %d %d\n", rindices[j], rindices[j + 1], rindices[j + 2]); } and out put is:
-1107141503 1047065916 1058222111 - 1118597697 -1083120598 1041096918 -1118541674 -1082575688 1040872831 -1129197583 -1082576454 1041095778 170 190 135 100 174 172 116 175 184 176 191 178 177 176 178 this doesn't happen always. has encountered similar issue?
ps numbers should 5th row , after. in advance.
after taking quick @ documentation, should call function gigetindexedmesh twice. first, retrieve required sizes (vcount , icount) setting last parameter null. , second time retrieve indices.
in code snippet, allocate array using old value of icount. required value determined later, must determine before:
giuint vcount, icount; gigetindexedmesh(&vcount, &icount, null); giunit *indices = malloc (...); gigetindexedmesh(&vcount, &icount, indices); i didn't find enough information on array layout. thus, didn't completed malloc call. should check return value of malloc gigetindexedmesh.
Comments
Post a Comment