   glDrawElements major slowdown
  So I switched from just glDrawArrays() to glDrawElements() and I get a major slowdown of about 15-18 FPS.  I cheak the render  function to see how long it's taking and it's only taking about 4-5 milliseconds (used SDL_GetTicks()).render:void CTerrain::RenderBruteForce(){glVertexPointer(3,GL_FLOAT,0,bfVertBuffer);glTexCoordPointer(2, GL_FLOAT, 0, bfTexBuffer);glDrawElements(GL_TRIANGLE_STRIP, m_height * m_width, GL_UNSIGNED_INT, bfIndexBuffer); }and in thisunsigned long time1 = SDL_GetTicks();terrain.RenderBruteForce();unsigned long time2 = SDL_GetTicks();unsigned long time = time2 - time1; printf("%d\n", time);"time" is only about 4-5 with some spikes here and there.I'm wondering why DrawElements would cause so much slowdown.   
  Firstly don't use unsigned integers for indexes unless you actually need them.  Try using an unsigned short instead, 0 to 65536 range and half the size of the integers.Secondly you may also want to interleave your vertex and texture coord data, put them in the same array and use the stride attribute.Thirdly you can also look into Vertex Buffer Objects (which can store the data on the graphics card (vram etc), much faster than VAs usually).EDIT: Fourthly you can optimize your index usages, if you are using triangle strips then you can check out NVIDIA TriStrip.  You can do the same for normal triangles.  Not sure how much of a speed up this will get you though.EDIT2: Fifthly, check out glDrawRangleElements.  It can be faster than glDrawElements but how much depends on the usage and your VB/IB setups.Hope that helpsbtw, What were you using before (Display List, Immediate Mode?) and what was the FPS before and after.   ;  printf("%d\n", time) is not really helping you frame rate because it's stalling the standard I/O. Have you tried without the printf?   ;  Thanks for the info guys.  I figured out it was the index loading algo.  It was drawing way more vertices than it need.  Now I'm up to about 300 FPS!  I'll cheak out that NVIDIA article though.   ;Quote:Original post by ntsFirstly don't use unsigned integers for indexes unless you actually need them.  Try using an unsigned short instead, 0 to 65536 range and half the size of the integers.Secondly you may also want to interleave your vertex and texture coord data, put them in the same array and use the stride attribute.Thirdly you can also look into Vertex Buffer Objects (which can store the data on the graphics card (vram etc), much faster than VAs usually).EDIT: Fourthly you can optimize your index usages, if you are using triangle strips then you can check out NVIDIA TriStrip.  You can do the same for normal triangles.  Not sure how much of a speed up this will get you though.EDIT2: Fifthly, check out glDrawRangleElements.  It can be faster than glDrawElements but how much depends on the usage and your VB/IB setups.Hope that helpsbtw, What were you using before (Display List, Immediate Mode?) and what was the FPS before and after.Actually IIRC some cards want unsigned int instead of unsigned short... Don't quote me but I think NVIDIA is optimized for the unsigned int.   ;Quote:Original post by MARS_999Actually IIRC some cards want unsigned int instead of unsigned short... Don't quote me but I think NVIDIA is optimized for the unsigned int.Both ATI and NVidia prefer unsigned shorts. See PerformanceTuning page 11 for details.   ;Quote:Original post by rick_appletonQuote:Original post by MARS_999Actually IIRC some cards want unsigned int instead of unsigned short... Don't quote me but I think NVIDIA is optimized for the unsigned int.Both ATI and NVidia prefer unsigned shorts. See PerformanceTuning page 11 for details.Hmm looks like you are correct. I swear that I seen somewhere that unsigned int was faster, but guess not.   