thanks for the replies
Quote:
pVerts is 1D array complVertex structure?
yes
it's a pointer to the first element of a std::vector<complVertex>.
Quote:
Did you forget to open the file in binary mode, such that an EOF character (Ctrl-Z, ascii 26 on Windows; Ctrl-D, ascii 4 on Unix) which happens to compose part of the binary vertex representation gets interpreted as the actual end of file?
don't think so. the ofstream is opened with:
std::ofstream ofs(filepath.asChar(),std::ios::out | std::ios::binary);
Quote:
You might try checking the status of ofs after each write. It is possible that an error is ocurring that causes the ofs object to become bad. The fact that nothing gets written to the file after the attempt to write pVerts would seem to point to an error ocurring in that write call.
just checked. Yes the file get's bad. What can cause that? Maybe there something wrong with getting the pointer(it's a little more complex than just a pointer to a vector in the same scope).
I have a function which computes uv coordinates,tangents and binormals for every vertex and it's ouput is 2 pointers and 2 ints. one pointer for the vertexindices,one for the vertices itself,1 int for the indices count and 1 int for the vertices count.
To output those i need to pass a double pointer to the function like this:
createVertices(/*other parameters*/,complVertex **ppOutVerts,int **ppOutIndices,int *numVerts,int *numIndice);
and in the function i do:
(*ppOutVerts)=&vertices[0];
(*numVerts)=vertices.size();
(*ppOutIndices)=&complIndices[0];
(*numIndice)=complIndices.size();
and call it like this:
complVertex *pVerts;
int *pIndices;
int vertCount,indexCount; createVertices(/*parameters*/,&pVerts,&vertCount,&pIndices,&indexCount);
is that correct?
regards,
m4gnus
"There are 10 types of people in the world... those who understand binary and those who don't."