| 38 | | |
| 39 | | // This comment is somewhat outdated... |
| 40 | | // |
| 41 | | // Damn. I already had some finished, fully object-oriented, extremely beautiful OpenGLWindowT and OpenGLWindowInputT |
| 42 | | // classes for all the stuff defined in here. Sadly, it didn't work. Several considerations: |
| 43 | | // 1. There is a lot of old code that relies on the below defined variables 'WindowIsOpen' and 'RenderingContextCounter' |
| 44 | | // for its OpenGL resource management (e.g. texture objects recovery after a rendering context change). |
| 45 | | // The otherwise beautiful OO approach of an 'OpenGLWindowT' class does not agree well with such variables. |
| 46 | | // Rather, every piece of code that needs them had to be changed to receive a pointer to the current 'OpenGLWindowT' object! |
| 47 | | // This is extremely ugly: The pointer must either be propagated across full function call depth, which will consume |
| 48 | | // enormous amounts of stack space for its numerous copies alone. The pointer-passing can be reduced at the cost of extremely |
| 49 | | // ugly, complex, and hard-to-maintain handler code. |
| 50 | | // Note that these pointers frequently change, at least once for closing and re-opening a window, |
| 51 | | // and each change must somehow be propagated to the user code. |
| 52 | | // Also note that a Cafu game DLL needs access to the current OpenGL window, which in turn means that I even |
| 53 | | // had to bloat the game DLL interface to account for all this gruesome complexity... |
| 54 | | // 2. First idea for improvement: Make everything OO, except one function like 'GetCurrentOpenGLWindow()' |
| 55 | | // which returns a pointer to the current 'OpenGLWindowT' object. |
| 56 | | // This function must answer the question which window is currently current (not necessarily the one that has focus), |
| 57 | | // and therefore probably also requires a 'SetCurrentOpenGLWindow()' complement function. |
| 58 | | // 3. Somebody explained me some interesting things about 'wglCreateContext()' and 'wglMakeCurrent()' a while ago. |
| 59 | | // Seems like rendering contexts (RCs) may survive their parent windows, and can be bound to future windows. |
| 60 | | // This approach might solve ALL ABOVE MENTIONED PROBLEMS at once, because their proper use in an 'OpenGLWindowT' |
| 61 | | // class and the proper use of 'glIsTexture()' (and related functions) in user code might make the need for |
| 62 | | // 'WindowIsOpen' and 'RenderingConextCounter' obsolete. |
| 63 | | // Sounds very well, but I still consider an immediate change to be risky. Is it portable? What if incompatible |
| 64 | | // pixel formats are desired between RC changes? Do we *really* get rid of demand for direct access to the 'OpenGLWindowT'? |
| 65 | | // Best is probably to make a thorough back-up someday, and try it out. |
| 66 | | // 4. Except for 3., I'm still not sure for multi-window programs if and how we can answer the users code question |
| 67 | | // if and when OpenGL resources are to be (re-)created. How do we manage multiple RCs? Do we have to, after all? |