Game Development Reference
In-Depth Information
Since RenderWindow::pushGLStates() is an expensive operation, our GameOb-
jectSFML class seems awfully inefficient, doesn't it? Having to save and restore states
in OpenGL for each object that uses SFML seems like a complete waste of resources. One
solution to this problem is to create a second render function in our base class, which
could be called GameObject::renderGL() , for example. In our main loop, things
will change a bit:
In this way, we will save a lot of unnecessary driver calls and make the code inside the
GameObject class a bit cleaner. Every object that does not use OpenGL will get this
method empty, while others will get GameObject::render() empty.
Search WWH ::




Custom Search