Original Post
All done, engine is almost ready to go - and it is now the best time to optimize mesh rendering.
Average measures of 1000 frames:

My models are being drawn in non-batched approach, what means every model in the terrain cell is drawed separately with a call to drawelements.
Some models consist of two objects inside (trees) (separate VBO per object in model), some have flags for alpha blending on, for bump mapping - they're passed to the shaders everytime i call them to be rendered.
I have already made a piece of code in the class that 'sorts' the models by their model type for an render, so instead of rendering model types: 1,3,1,2,5,2,1,1,6,1
engine is rendering 1,1,1,1,1,2,2,3,5,6. This is the first thing that needs to be done, before i start to batch anything i suppose.
Now the only batching approach i came up to is as follows:
Might be that i would have to 'consolidate' the VBO's of the models having the same type and render them with one call to get that frame timing better?
Before i do anything with that batching, i would like to ask you guys if the 'approach' i have suggested has some major 'cons' inside?
Thanks for any suggestions.
Average measures of 1000 frames:

My models are being drawn in non-batched approach, what means every model in the terrain cell is drawed separately with a call to drawelements.
Some models consist of two objects inside (trees) (separate VBO per object in model), some have flags for alpha blending on, for bump mapping - they're passed to the shaders everytime i call them to be rendered.
I have already made a piece of code in the class that 'sorts' the models by their model type for an render, so instead of rendering model types: 1,3,1,2,5,2,1,1,6,1
engine is rendering 1,1,1,1,1,2,2,3,5,6. This is the first thing that needs to be done, before i start to batch anything i suppose.
Now the only batching approach i came up to is as follows:
void class::renderCell()
{
//PSEUDOCODE
shaderON();
- X = how many objects make up this model
- Y = model's of that type in this cell
for X;X++
- bind vbo of the object
- set the shader uniform data
for Y=model_count_in_cell
pushmatrix
glTranslate to actual model.position
glRotate to actual model_rotation
draw_bound_vbo
popmatrix
endfor
- unbind vbo
endfor
-shaderOFF
}
Might be that i would have to 'consolidate' the VBO's of the models having the same type and render them with one call to get that frame timing better?
Before i do anything with that batching, i would like to ask you guys if the 'approach' i have suggested has some major 'cons' inside?
Thanks for any suggestions.



