I’m trying to write a rending engine that minimizes state changes by sorting objects by the opengl state that they require to render. This is a two part question:
Currently I’m planning to try preserve video memory by keeping texture parameters (eg filtering, wrapping, etc) separate from the opengl texture id and hence the texture data. This seems better if say a texture is loaded twice with different filtering, then the bitmap data isn’t duplicated (I’m already reference counting and using handle objects to my application’s internal texture objects). The downside of this is that it adds more complexity to my code since there are more redundant calls to check for and it means I have to do more than a glBindTexture when I change textures as I render the frame. Is this a false economy? Is changing the texture parameters expensive enough that it warrants creating two textures?
Can anybody point me towards some kind of chart that ranks opengl operations by approximately how expensive they are? I want to make sure I’m not wasting time and adding complexity by doing unnecessary “optimization” Or is this completely driver/hardware dependent?