Subwindow slows my app

Hi I have a subwindow that I use for a map in one of my programs, but when I have it on it slows my frame rate by half. I need this map in my game, but can’t think of any other way to display it. Is there a way I can speed it up or do I have to find a another way to show it?

Hi !

Context switcing can be slow so you might want to try to only use one window and put the map in one corner or so, use glViewport to select the area of a window to render to.

You should of course also have a peek at your code and see where you can improve performance a bit.


Well I’ve disabled all rendering to the subwindow and it’s still slow so I think I should try the glViewPort, but I’m not sure how to use it could you post some code please?

It depends on what you want to display the map for.

If you want to display the map, why not try a single textured quad in Ortho mode? You can scroll it by using the texture matrix or by changing the UV coordinates.

If the whole map needs to be updated often I suggest rendering to texture when it needs to be updated. You don’t need high detail textures or complex shaders in a small map so it should be faster. Also, it typically does not need to be updated every frame.

If the map basically stays the same but you want to display some objects on it, just render those in a 2D mode after rendering the map. The map itself can then be a static texture.

If the map needs to be updated sporadically, you might even just re-upload the texture when it changes. But render to texture could do it just as well.

Well I’m not that great with textures, all I can do is texture map objects, not create them or edit them during the program. I think maybe the glViewPort may still be my best bet