|
|
# Modern OpenGL Overhaul
|
|
|
|
|
|
This page is a technical document describing plans for the new OpenGL renderer.
|
|
|
|
|
|
## Dropping `src/hardware`
|
|
|
|
|
|
All of the code here is gross, old and basically unmaintainable. The reason being, the interface was designed with the idea that the backend driver could be swapped out and replaced freely. This is completely unnecessary, and that driver's interface was designed for very old APIs with fixed function pipelines. We will replace it with an entire new system, and all hooks into the old code will be replaced.
|
|
|
|
|
|
## Inspiration
|
|
|
|
|
|
The [Strife: Veteran Edition source release](https://github.com/svkaiser/strife-ve/tree/master/strife-ve-src/src/opengl) shows a fantastic OpenGL 2.0 renderer for Strife. It is mechanically similar to my vertex array approach, but extremely well organized.
|
|
|
|
|
|
[Doom iOS](http://fabiensanglard.net/doomIphone/#RendererDoomGL) features a unique use of `libtess` from the GL reference implementation and a quicksort of triangles based on texture in order to minimize texture rebinds. Modeling ourselves after S:VE's renderer may enable us to do this later on down the road much more easily than I had been trying before.
|
|
|
|
|
|
## Goals
|
|
|
|
|
|
* As minimal complexity for preprocessing as possible before sending the vertex information to the GPU.
|
|
|
* A single endpoint for drawing everything in the game world.
|
|
|
* A single endpoint for UI drawing.
|
|
|
* The ability to swap out these endpoints for rendering via GLES, GL 3.2, GL 2, etcetera (starting only with a GL 2 implementation).
|
|
|
|
|
|
# Draw lists
|
|
|
|
|
|
When drawing, we will collect draw lists based on tags rather than immediately drawing out to the screen. Separate tags will be used for each of the major renderable types in the engine.
|
|
|
|
|
|
During the drawing step, the code will have the ability to consolidate these draw lists in efficient chunks (sorting like Doom iOS) after processing their vertices.
|
|
|
|
|
|
# Shaders
|
|
|
|
|
|
The vertex and fragment shader for all world drawing, and the pair for UI drawing, will be predefined lumps within the game WADs. This way, they can be overridden by mods.
|
|
|
|
|
|
# MD2s
|
|
|
|
|
|
Reimplementing MD2s is not a priority, but it shouldn't be hard to get them either. I suspect we'll be able to simply make them another draw list tag. They might use their own shader set. |
|
|
\ No newline at end of file |