Hey guys,
My time is short, so Ill have to keep this short also:
I load position, normals, texturecoords and faces from .obj data. Works fine.
Now I need the indices, but i cant manage to calculate them proberly from the faces.
When I load a cude, the front and left side are not there.
Code looks like this:
(Code-Tags still not working thought)
int indexI; indexI = 0;
for(int i=0;i<faceCount;i++){
indices[indexI] = faceData[(i*4)]-1; //-1 cause faces start with 1
indices[indexI+1] = faceData[(i*4)+1]-1; //*4 cause every face has 4 vertices
indices[indexI+2] = faceData[(i*4)+2]-1; // faceData is just a list of all faces,
// eg: 1 2 3 4 5 8 7 6...
indices[indexI+3] = faceData[(i*4)]-1;
indices[indexI+4] = faceData[(i*4)+2]-1;
indices[indexI+5] = faceData[(i*4)+3]-1;
indexI += 6;
}
Can someone provide usefull information on this? Thanks
Loading .obj problem
switching +3 and +4 makes the cube even more messed up. Disableing culling only shows more clearly that the two sides are missing.
I fixed it. This code was correct, but the bytewidth of the indexbuffer was to small *facepalm*
Well, thanks anyway. Can someone tell me why this causes that kind of trouble?
I fixed it. This code was correct, but the bytewidth of the indexbuffer was to small *facepalm*
Well, thanks anyway. Can someone tell me why this causes that kind of trouble?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement