PDA

View Full Version : opengl drawing and view handling



12-17-2004, 12:29 AM
i have currently finished making a 3ds loders class for a game engine i'm making but i am having rendring problems:

firstly is looks like the mesh i load is missing polygons only black pachs replace it even with texture mapping there. I have assigned a normal per vertex could that add to this problem.

and, another problem i have is that i have to scale down the vertice data all the time so i just divdie by a hundred and that works, is there another way apart from glScale();

Aeluned
12-17-2004, 07:32 AM
as far as the black patches are concerned:

This could be a winding problem.
do you have polygon culling enabled?
did you specify the front face using glFrontFace?

iznogoud
12-17-2004, 08:51 AM
Avoid using glScale if there are other ways to deal
with that issue -- like a post-loading -pre-use scaling.

Winding is most likely the problem, glDisable face
culling is good way to quickly test if that is the
problem.

A final thought; do not leave anything to luck! For
example, I like to use culling so I make sure that
all my triangles are winding the "right" way (I like
it counterclockwise). So, every time I load an object
I check the normal vector of each triangle (which
you can generate with a cross product of the vectors
formed by the nodes' coordinates) against the per
vertex normals. If the result informs me that the
triangle winds in the wrong direction, I interchange
the order of two of the nodes. Simple.

12-18-2004, 12:42 AM
thanx for the adivice, how do u use the surface normal and the pervertex normals to adjust the winding? some sample code would be good..