[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rendering triangle meshes with OpenGL



On Tue, Sep 24, 2002 at 01:31:00PM -0300, Miguel A. Osorio wrote:
> Katie Lucas wrote:
> > 
> > 
> > Some verticies will represent end-points of a line which delineates a
> > texture - it's a point at which textures meet. Imagine a sphere with a
> > map of the earth mapped onto it. The verticies in the Atlantic will
> > have one world position and one texture position. The verticies along
> > the international date line will have one position, but TWO texture
> > coordinates. One set running down the left of the map, one set running
> > down the right of the map.
> 
> 
> 	Hum, I got this figured out, at last. It seems that data from ASE files
> is face based. Which means that each face can have unique information,
> regarding texture coordinates and normals. So depending on the face the
> same a vertex can have many tex coords and many normals. Since I render
> using GL_TRIANGLES, I can send this unique info for each face.
> 
> > 
> > There is no easy way to fix this since OpenGL expects data to arrive
> > as one block per vertex, including the colour and the texture position.
> > 
> > The solution is to massage your data before using it. You will need to
> > duplicate the verticies with >1 texture. In other words, if the
> > equator had 12 points round it in the above example, you need to
> > create a 13th point with the left hand edge of the equator on it, and
> > modify the 12th point so it has the right hand edge only. And then
> > re-write the triangles so they all work.
> 
> 
> 	I was wondering if I could condense this extra information without
> expanding the arrays, that is, reducing the number of entries in the tex
> coord array and the normal array.

Ah... only if the texture continues across the surface at that point -
then all the triangle corners that meet at that point will have the
same texel rendered to them.

You can reduce the normals by averaging them if they are not the same,
but this will "round" the object. It might be suitable for some
objects but not others.