PDA

View Full Version : speed



davidib
02-04-2005, 07:56 AM
hi i am spanish and my english inst very good

i am new with opengl and i see the lists, drawelements, vertex, etc functions for draw triangles, strips, etc

speed up if i use drawelements, lists or other functions?

in my test with piramids i see the equal fps using glvertex function or call lists

thx people

Aeluned
02-04-2005, 08:44 AM
a pyramid has, what, 16 vertices (if not shared)?
you won't see much of a performance gain for such a trivial amount of vertices. Try drawing a few thousand triangles and compare your render methods again.

davidib
02-05-2005, 02:28 AM
i load a asc scene (10000 vertex) maked with 3dsmax and draw with diferent functions and the fps is equal, i use glut in gamemode i have pentium iii 1200 and gforce 2 mobile 16mb

mikael_aronsson
02-05-2005, 02:42 AM
Hi !

If you have vsync on this might be limiting the frame rate, is it 60/70 FPS or something like that every time you test it ?

Mikael

davidib
02-05-2005, 04:33 AM
no the vsync is off, i see 18/34 fps in 800x600 32bpp

davidib
02-05-2005, 05:56 AM
my functions for draw:

// This use a basic glvertex and call for triangle
// Renderizar un triangulo
void CDraw::DrawTriangle( CTriangle *p )
{
// TODO: Mirar si se debe o no de dibujar este triangulo

// Incrementar el contador de dibujado de triangulos
AddCounterTriangle( 1 );
// Dibujar el triangulo
for( int iVertex = 0; iVertex < 3; iVertex++ )
{
// Obtener el vertice a renderizar
CVertex *pVertex = p->vertex[iVertex];
glColor3f( pVertex->color.x, pVertex->color.y, pVertex->color.z );
glVertex3f( pVertex->point.x, pVertex->point.y, pVertex->point.z );
}
}

This use the glDrawElements and no one call for mesh
// Renderizar toda una estructura surface
void CDraw::DrawSurface( CSurface *p )
{
AddCounterTriangle( p->GetNumTriangles() );
// Indicar buffers
glVertexPointer( 3, GL_FLOAT, sizeof(CVertex), &p->GetVertex(0)->point.x );
glColorPointer( 3, GL_FLOAT, sizeof(CVertex), &p->GetVertex(0)->color.x );
// Activar arrays
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
// Renderizar surface
glDrawElements( GL_TRIANGLES, p->GetNumTriangles() *3,
GL_UNSIGNED_INT, p->GetIndexBuffer() );
// Desactivar arrays
glDisableClientState( GL_COLOR_ARRAY );
glDisableClientState( GL_VERTEX_ARRAY );
}

davidib
02-05-2005, 05:58 AM
sorry i see a bug in my post

This use the glDrawElements and YES one call for mesh
// Renderizar toda una estructura surface
void CDraw::DrawSurface( CSurface *p )

davidib
02-06-2005, 12:44 AM
in my test i see this, the gldrawelements use the frustum for draw, but if i use a my frustum after a draw using glvertex is equal

gldrawelements no speed up, only optimize the draw :)