Note that there are some explanatory texts on larger screens.

plurals
  1. POLearning OpenGL while practicing TDD (unit testing)
    primarykey
    data
    text
    <p>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.</p> <p>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.</p> <p>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.)</p> <p>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.</p> <p>Where is the middle ground? How to I learn to use OpenGL while at the same time doing proper unit testing beforehand?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload