help with 3ds loader from gametutorials

I realize that mabey this isnt the best question for this forum but the forums over at gametutorials.com are down right now.
Every time I try to use his gametutorials 3ds loader I get the object to load but it looks as though there is no depth testing on because I can see back facing polys through the fron ones. I have enabled depth testing and cleared the buffer so I know thats not the problem. I have almost vituraly copied his code to see if it will work. Also I know its not the object because I have used his and It doesnt work.

Did u test the normal smoothing routine (if I remember it has one), maybe it just invert the order of vertex while creating the normal out of triangle vertexes.

I’m not familiar with the loader code you mentioned, but it sounds like you may need to handle 2-sided materials as read from the 3DS file (chunk ID = 0xA081) and add the attendant extra surfaces that map to those materials at mesh loading time.

See Display3DS for a legible example (Windows (VC++/MFC) and Mac OS X (Objective-C/Cocoa) only).

Compare your loader code with how Display3DS adds an extra surface and computes surface normals when a polygon uses a 2-sided material:

#include “Mesh3DS.h”

void Mesh3DS::AddPolygon (TRIANGLE tri, char *MaterialName)
{
int MaterialNum;

SURFACE TempSurface;

TempSurface.p0 = tri.p0;
TempSurface.p1 = tri.p1;
TempSurface.p2 = tri.p2;

if (!CalculateSurfaceNormal (&TempSurface)) return; // Ignore degenerate polygons

MaterialNum = FindMaterialIndex (MaterialName); // Find the polygon list index we belong to

POLYGONLIST poly_entry = (POLYGONLIST) PolyList[MaterialNum]; // Attach a new triangle to the polygon list

SURFACE surface_entry = (SURFACE) poly_entry->TriangleIndexList[poly_entry->TriangleIndexList.Add (new SURFACE())];

surface_entry->p0 = tri.p0;
surface_entry->p1 = tri.p1;
surface_entry->p2 = tri.p2;

CalculateSurfaceNormal (surface_entry);

if (poly_entry->doublesided) // Attach another surface for the second side
{
SURFACE surface_entry = (SURFACE) poly_entry->TriangleIndexList[poly_entry->TriangleIndexList.Add (new SURFACE())];

  surface_entry->p0 = tri.p0;
  surface_entry->p1 = tri.p2;											// Flip polygon orientation for back-facing surface
  surface_entry->p2 = tri.p1;

  CalculateSurfaceNormal	(surface_entry);
  }

}

Try running your 3DS mesh through Display3DS with & without the ‘Force 2-Sided’ menu option enabled to see if we’re on the right track.

Cheers,
/p2

[This message has been edited by ppinter1 (edited 02-05-2003).]

I have faced this problem before.
I just put the glEnable(GL_DEPTH_TEST);
then it work…

huh?