Ejemplo n.º 1
0
PDGL_API void pdglDrawElements( GLenum mode,
	GLsizei count, GLenum type, const GLvoid *indices )
{
	if(pglDrawElements)
		{ pglDrawElements(mode, count, type, indices); return; }
	pglDrawElements=pdglGetProcAddress("glDrawElements");
	pglDrawElements(mode, count, type, indices);
}
// draw prepared arrays
static void ogl_DrawElements( INDEX ctElem, INDEX *pidx)
{
  ASSERT( _pGfx->gl_eCurrentAPI==GAT_OGL);
#ifndef NDEBUG
  // check if all indices are inside lock count (or smaller than 65536)
  if( pidx!=NULL) for( INDEX i=0; i<ctElem; i++) ASSERT( pidx[i] < GFX_ctVertices);
#endif

  _sfStats.StartTimer(CStatForm::STI_GFXAPI);
  _pGfx->gl_ctTotalTriangles += ctElem/3;  // for profiling

  // arrays or elements
  if( pidx==NULL) pglDrawArrays( GL_QUADS, 0, ctElem);
  else pglDrawElements( GL_TRIANGLES, ctElem, GL_UNSIGNED_INT, pidx);
  OGL_CHECKERROR;

  _sfStats.StopTimer(CStatForm::STI_GFXAPI);
}