Original Post
Hi, I've used vertex arrays (VA) to render my meshes; I load them as 3ds models (I use l3ds): everything is ok (vertices, normals, texture,...) Today I had the 'brillant' idea: why not use vertex buffer objects (VBO)? I've implemented a simple class to manage VBO so I can switch between VA and VBO quite easily; if the renderer found VBO initialized use them otherwise use VA. The first execution was a crash (I did not binded before call glVertexPointer :) Now everything works (read more>>>) In my mesh I use common structures like these
class MeshVertex{ public:
GL::Vector3f vertex;
GL::Vector3f normal;
GL::Vector2f texcoord;
GL::Vector2f texcoord1;
}
and
struct Triangle{
GLuint a;
GLuint b;
GLuint c;
}
In other words I need to 'interleave' my arrays. I learned how to do this (NVidia has posted a lot of nice tutorials)(simply specify stride and offset as in vertex arrays) But this is not the question because everything work also with VBO (no crash, no gl errors, proper light, texture,...). The problem is that this approach is TOO SLOW!!! Not slow : STATIC!!! :) I cannot quantify exactly but my approximated FPS goes from 100fps for a certain model to 0!!! (in other situations it is the half than VA) Now I'm using an 'old' GE Force MX440 with XP (I've not tested yet with a slight better FX family that is on a different system); I know that this is not an 'hard core graphic card' but I suppose it should be something wrong in what I've done. I use BufferData only when my (static) model change (loading, modify) then I use only BindBuffer (so I dont pass geometry anymore). I tried to use both STATIC_DRAW and DYNAMIC_DRAW (with the same bad results!!!). I also use glDrawRangeElements() and in my VBO managment class I dont bind a buffer if it is currently in use. In other words I've tried every optimization to avoid the problem I have! Have you experienced the same problem? Can you suggest a solution ? ANY IDEA ??? I've read a lot of tutorials in which there is no use of interleaving...is this the problem? (NV spec say that this does not affect performance and in facti it works slow but properly) Thanks for any suggestion !!! Ciao