I know that it is quite expensive to do a glTexImage*D(…) every frame, so there are texture objects. They contain the state of a texture, as filters, wrapping mode. Now my question:
Are the calls to glTexParameter() also expensive or does it have only minimal impact on performance when I would for example everytime I do a glBindImage set up all texture parameters. Or is it better to store the parametes with the object?.
The reason is that I want to implement a singleton texture manager and I’m not sure what to do with the texture parameters. With texture parameters not bound to the texture objects it would be no problem to to change for example anisotropic filtering just after the glBindTexture().
Btw there is another problem I’m not sure how to handle, its a little bit OT; but does the use of run time type information slows down an app.When I would use it,it would simplify interaction between objects of my scene, without it I would have to store the class information by myself for example as an int?
Some of those things are extremely heavyweight. Otehrs probably aren’t. Look at MIP map filtering for example. That’s a parameter that would cause a significant overhead (not to mention screwing up your MIP levels if you unset it)
The tex parameters are part of the texture just like the currently defined bitmap image(s). I suggest you let OpenGL keep them in the object. You seldom need to change, for example, the minification filter for the same image, once it’s defined.
I’m sure you already know this, but when I started out with OpenGL, I thought that TexEnv was kept with the object as well. It isn’t, and typically you’ll need to set it up when you re-bind textures (unless it’s already in the mode you need).
thank you. So i’ll let the texture parameters stay with the object and change them only when it is needed.I asked because it is an important ‘design’ decision while writing a textue manager. Now each Texture will have a struct with texure parameters, so I can as needed change only the necessary onces.