I am attempting to make a full scale game for the first time and I was hoping if someone more experienced in game making could tell me how you are supposed to store 3d models and 2d textures (OpenGL). I have seen some examples in which a static class is used that stores all of the textures and data loaded and other classes get the textures from that class. In other examples I have seen people store a static texture in the class that will use it. I do not know what is the best practice for doing this. As a side note I will port the game to Objective-C and put it on the app store which is why I am using OpenGL.
Share
I would break up my Game into Screens and AssetBundles. An AssetBundle has a list of references which can load models, textures, audio, etc. Each Screen has an AssetBundle (or a list of them) which must be loaded for the screen to proceed drawing.
I break up my resources into an AssetBundle because sometimes there are textures or sounds you don’t need for gameplay that you only needed for the title screen (for example).
A screen for example is TitleScreen, MenuScreen, GameScreen (main game). Screens could layer, or may not.
The magic happens within a ScreenManager class, you can add/remove screens and each screen is drawn in the order added to the manager. When a screen is added to the manager it loads any AssetBundles that aren’t already loaded. If a screen is removed, it will remove the AssetBundles in that screen if none of them exist in any of the existing screens in the manager.
Thats how I would do it atleast.