Dear All,
I recently started making an OpenGL 2.1 framework more core like by removing uses of features which are deprecated. The framework is educational, and I would like it to be helpful to students interested in mobile graphics. Hence the need for change.
Actually, materials, lights, transformations etc. were simple to deal with since the framework is already shader based. However, display lists I cannot get rid of. Te thing is that I load an object from an obj file which uses 23 materials, 12 textures, and has 60 usemtl instructions.
Obviously I do not want 60 draw calls, so in the end I compiled one display list for all geometry which calls nested display lists that contain state changes. The geometry list is created just once. The nested material lists are created for every time the shader changes (actually every time the object is drawn). This works well, and it takes into account the issue that I cannot create a single display list which works with all shaders since they have different uniform bindings.
However, it is not very core’ish. My assumption is that for core GL I need to fix the asset. For instance make a material array and combine the textures into a texture atlas or a texture array or fire up a content creation tool and fix the assets there. Banal perhaps but important to point out to learners
In any case it is ok, but what it means is that OpenGL compatibility is far more tolerant of ill structured assets. Just curious whether you agree with this or whether you feel I overlook something?
- Andreas