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

Re: Rendering triangle meshes with OpenGL



Miguel A. Osorio wrote:

>Hey people,
>
>
>
>
>	I found out that, currently, the performance bottleneck in my
>application (a simple 3D engine) is the graphics pipeline. What got me
>wondering is my triangle mesh rendering buiseness. This is how I got it
>working: I read 3D models from ASE files (ASCII Scene Export from
>3DSMax) and, as some of you might well know, it's a very simple format
>-> a list of all vertices and the list of all triangles, which reference
>the vertices by means of indexes. So all I do then is compile a display
>list for each model, something like:
>
>glBegin(GL_TRIANGLES);
>
>	for(i=0; i < NumberOfFaces; ++i) {
>
>		// Vertex one
>		glTexCoord2dv(bla bla);
>		glNormal3dv(bla bla);
>		glVertex3dv(bla bla);
>
>		// Vertex two
>		(...)
>	
>		// Vertex three
>		(...)
>
>	}
>
>glEnd();
>
>
>	Thing is, I'd like to know if this way of doing it is ok in terms of
>performance, if this could be the cause of my slowdown. I know there are
>more efficient ways of doing this, like for instance, pre-processing the
>geometric data and converting everything to triangle strips, but is the
>presented way a bit too slow?
>
I think you should have a look at glDrawElements() instead. This is a 
lot faster
compared to using display lists.

Greetings,

>
-- 
==============================================================================
Jorrit.Tyberghein@uz.kuleuven.ac.be, University Hospitals KU Leuven BELGIUM

"In a word -- im-possible!"
"That's two words," said Dibbler.
        -- (Terry Pratchett, Moving Pictures)
==============================================================================