I have started a new game project, and have decided to learn and use OpenGL for it (project is being simultaneously developed on Windows and Linux). At the same time, I am also very interested in Test Driven Development, and am trying to put my best effort into writing my unit tests to lead design before any actual code.
However, I think my lack of knowledge might be tripping me up, and I keep hitting a wall in trying to write my unit tests for the "rendering" parts of the codebase. I'm hoping someone can give me some insight on how to continue.
I know that I need to unit test my interactions with OpenGL, and not OpenGL itself. The only way I can see to do this is to abstract OpenGL away from the rest of my code to some extent, either by intercepting OpenGL function calls, or by creating a whole new class interface, allowing me to create a mock version of that class for the tests. (Even better would be to abstract them to a set of non-class functions in a separate namespace rather than virtual class abstractions, but I don't see how I could mock that.)
However, as I'm still learning OpenGL, I only have a passing idea of what that abstraction should look like. For example, shall I wrap each OpenGL call, or group them into higher-level functions based on tasks to be accomplished? Thin wrappers would do little more than call a particular OpenGL function, so I wouldn't need to test them beforehand, but I could end up with a large number of functions to wrap. Then again, if I go too far the other way and group multiple OpenGL calls together by task, I feel like I'll end up where I started, having a large body of code using OpenGL that itself needs to be tested before use.
Where is the middle ground? How to I learn to use OpenGL while at the same time doing proper unit testing beforehand?