UPDATE: This has now been solved! A video showing the new code in action can be seen here: http://www.youtube.com/watch?v=q4S664yizGo
Hi all,
I’ve hit another rather annoying roadblock with my level editor / engine, and this one seems to have fairly serious implications for the way I’m doing things.
Here’s a screenshot of the editor running to give you some context for the issue:
(Please ignore the red / blue highlights - they’re markers to help me orient my UV coordinates)
So here’s the deal. The level is made up of segments that look like this:
A segment is made up of 5 potential textures - a floor, ceiling, inner wall, upper wall and lower wall texture. The upper and lower wall textures are used for segments that have overhangs or steps, such as in the following image:
The problem I have is that, up until the previous iteration of the editor I had been drawing all of this geometry using immediate mode (glBegin()… glEnd()), this was combined with a texture atlas and modified UV texture coordinates to give me a decent render speed (to save repeated texture binds).
This was the original texture atlas:
However, after upgrading my geometry to display lists - which has given me an incredible 500fps boost - I can now no longer manipulate the texture coordinates of each group of quads once they’ve been compiled into the display list. It has to bind to a unique texture each time it needs to draw a different group of quads.
As you can see from the UI output data in the screenshot, I have a terrible, terrible number of texture binds.
I’m using around 4 different display lists to make up the segment - a floor / ceiling list, a wall list, and a list for both the upper and lower overhangs. Altogether they give me amazing performance benefits over immediate mode, but this problem has now left me questioning whether this was, in fact, the right way to do it.
If anybody else has managed to solve this problem, I’d be most grateful for some input.
Many thanks!