All GL performance guides say that when you want to reset a matrix, you use glLoadIdentity instead of uploading your own identity matrix.
In Irr currently, only the texture matrices do this, the other matrices upload their own.
Why is this?
GL setting of identity matrices
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: GL setting of identity matrices
Well, where would you assume to find the identity matrix? Or do you say that one should always first call LoadIdentity first?
Re: GL setting of identity matrices
It would call the isIdentity method, just like is done for the texture matrices, see line COpenGLDriver.cpp:980 in current svn.
I mean, if one calls setTransform(ETS_WORLD, IdentityMatrix), irr spends time uploading its own identity matrix instead of calling the faster glLoadIdentity. But if setting a texture matrix instead, it detects it's an identity matrix and correctly uses the faster function.
I mean, if one calls setTransform(ETS_WORLD, IdentityMatrix), irr spends time uploading its own identity matrix instead of calling the faster glLoadIdentity. But if setting a texture matrix instead, it detects it's an identity matrix and correctly uses the faster function.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: GL setting of identity matrices
The reason is that for texture matrices, about 99.9% will be identity, but for transformation, only 0.1% will be. So a check will be probably counter productive, as it will almost always fail and cost a few cycles each time.
Re: GL setting of identity matrices
Then maybe add a setTransformIdentity call, only taking the target matrix as a parameter?