   Inefficient terrain rendering
  I'm rendering a simple terrain mesh using vertex arrays, but it seems ridiculously slow for what I'm doing.  Here's a quick breakdown of what I do:I want to eventually texture the map and blend together adjacent tiles that have differing textures.  So to start off, I just broke down the quads into differing terrain types, grass if the height is above a certain value and water otherwise.I have one array for the normals and one array for my vertices.  I also have an index array for each texture type that has to be drawn (which is just two for right now).  When I initialize everything, I randomly generate the terrain and stick the tile coordinates in the appropriate index array.The vertices are laid out in row major order in my vertex array.Then when I want to draw everything, I just do this:glEnableClientState(GL_NORMAL_ARRAY);glEnableClientState(GL_VERTEX_ARRAY);glVertexPointer( 3, GL_FLOAT, 0, m_pVertices );glNormalPointer( GL_FLOAT, 0, m_pNormals );for(int k = 0; k < NUM_GROUNDTYPES; k++){glDrawElements( GL_QUADS, m_iNumTiles[k]*4, GL_UNSIGNED_INT, m_pIndices[k] );}Everything should be pretty self explanatory.  m_iNumTiles[x] just keeps track of how many tiles were assigned to each ground type.  Since a quad uses four vertices, I just multiply that by 4 to know how many vertices to process.  m_pIndices is a 2D array that keeps track of the indices for each ground type.My question is, why is this so painstakingly slow?  I'm not doing anything else at all in the program.  I'm not even texturing anything and I only get 40ish FPS from my 256*256 mesh.  If I make it 512 by 512, it drops to 25 FPS.  Is it inefficient with regards to cache misses?  Or am I just completely overlooking something?   
  You'd notice a massive speed up if you used a GL_TRIANGLE_STRIP instead of GL_QUAD - but it shouldn't be THAT slow...   ;  Right, I know it'd be more efficient to use a strip instead of a quad, but with the way that I'm going to be rendering things, I don't know if all the vertices and texture coordiantes will be laid out in a nice enough order to use a strip.  Like you said though, it shouldn't be nearly as slow as it is =/   ;  Then use a triangle list. That will still (hopefully) be much faster. (And after you cache prime the list, it will be even faster than strips anyway.)   ;  using strings or triangles wont help much if at all, the main problem is youre drawing everything in one go 256x256 = 65k(normally cards operate on smaller values in a single draw call but most importantais u need to seperate your terrain up into blocks subdivide eg 256x256 = 8x8 blocks of 32x32verts. thus 64blocks totalstick a bounding box around each block + only draw it if its onscreen.this should at least double your frame rate   ;Quote:Original post by zedzeekusing strings or triangles wont help much if at all, the main problem is youre drawing everything in one go 256x256 = 65k(normally cards operate on smaller values in a single draw call but most importantais u need to seperate your terrain up into blocks subdivide eg 256x256 = 8x8 blocks of 32x32verts. thus 64blocks totalstick a bounding box around each block + only draw it if its onscreen.this should at least double your frame rateI can't agree with you on this one zedzeek, I have had my mesh at 256x256 using strips with an indexed array and arragned my terrain to be called in one call and actually got a speed boost due to reducing the CPU calls to the glDrawElement()... I am also using VBO's. But my case is probably different than his. I am now using view culling and having to loop through to draw whats visible instead of drawing all in one call now and that has speed up my fps again. So the situation determines what course of action to take.   ;  The speed depends somewhat on his gfx card, mine can chew up a 512*512 terrain in one go with no problems.What kind of gfx card are you packing there Kaezin?   ;Quote: But my case is probably different than his. I am now using view culling and having to loop through to draw whats visible instead of drawing all in one call now and that has speed up my fps again.if u read what i say thats actually what i recommend :);Quote:Original post by phantomWhat kind of gfx card are you packing there Kaezin?Radeon 9600 XT, 256 MB.   ;  That card shouldn't have any issue with 256x256 terrain meshes... I ran my old terrain engine on that a long time ago and got those fps with shaders, water, sky ect. many effects all in the same frame. You may need to post your code of how you are rendering and setting up your data.   