Renderware
I am making a renderware 3d loader and I have a problem where everything works right except the cube is not really a cube. I need to know how the face arrangements work if anyone could help me with that.
What is a "renderware 3d loader"? The only thing called Renderware, it EA's in house engine...
...and "the cube is not really a cube" is an almost metaphysical error description.
My guess is that we're actually talking RenderMan, and that your problem is that your face normals are smoothed?
My guess is that we're actually talking RenderMan, and that your problem is that your face normals are smoothed?
Here is something better. I'm making an obj file loader and when I display the model the faces are all messed up in some sort of weird cube that looks like it got tangled up in itself. I know I am loading the file correctly because I made it print out the results and it matches to the file. Here is the code for the part that makes the display list. (these aren't the actually variables i used)
Code:
void loadlist(int num)
{
models[num]=glGenLists(1);
glNewList(models[num], GL_COMPILE);
int l=0;
while(l<numoffaces)
{
int g=0;
glBegin(GL_POLYGON);
float normal[3]={0,0,0};
while(g<numofpointsperface[numfaces])
{
int j=face[l][g][0];
normal[0]+=v[j][0];
normal[1]+=v[j][1];
normal[2]+= v[j][2];
g++;
}
g=0;
while(g<numpointsperface[numfaces])
{
int j=faces[l][g][0];
glNormal3f(normal[0]/numpointsperface[numfaces], normal[1]/numpointsperface[numfaces], normal[2]/numpointsperface[numfaces]);
glVertex3f(v[j][0], v[j][1], v[j][2]);
g++;
}
glEnd();
l++;
}
glEndList();
}
I swear to you (without even reading your code) that you're missing that OBJ files start counting at 1 instead of 0 when defining the vertex/normal/tex indicies in the faces. ^^

