I’m in the process of constructing a 3d engine of sorts and need to be able to track the ModelView matrix for each ‘entity’ that’s rendered (for reasons i won’t get into), an entity in my case is simply a vertex buffer object that’s drawn at a certain location.
At the moment i am going down the route of using my own translation/rotation code to generate a matrix that’s sent though glLoadMatrix, which means i can store the current matrix for each entity. I could however simply use glTranslate/Rotate/Scale and use glGet to grab the current matrix at the time of rendering the entity and store it somewhere.
I am wondering which is the ‘best practice’ for this kind of thing;
the advantage as i see it with my own matrix code is that i get to leave glGet alone (experience has taught me that quick code and glGet don’t go hand in hand for obvious reasons) but there is always the very good chance that a lack of understanding of matrix code (from a lack of good resources dedicated to matrix code and opengl [although i am struggling by okay]) might lead to small errors that can quickly grow into large hard to track down errors.
Given that there might not be too many entities drawn per frame the glGet slowdown might be worth the ‘correctness’