Combination of an OpenGL CView, an OpenGL CWnd, and GDI
-
I've got an open source game that's a port of the board game Settlers of Catan, and it uses OpenGL in a CView for the game rendering and GDI over that for information display and user interaction. The game is available at http://www.settlers3d.net and the source is all at SourceForge.net under the project 'settlers3d'. I am now in the process of adding a brand-new expansion to the game and I want to have a separate 3D rendering of the progress of a certain ship piece over a certain tile (called the 'barbarian attack' in the game). This rendering will be informational only and totally static, meaning the users can't interact with it like they do the main CView OpenGL window. I'm trying to create a new CWnd based OpenGL window for this barbarian attack that is displayed in its own area that overlays the OpenGL CView. (It actually slides in and out from the side of the game window, but that's extemperaneous to the problem.) I have created the new OpenGL CWnd and gotten it to display what I want, however, all of the Windows GDI drawing is now very messed up. Here is a screenshot. It seems that with the OpenGL CWnd turned on, something is messed up with the display contexts for all of the GDI drawing. If I comment out the Create() call for the OpenGL CWnd, everything works properly again. If I move the application window around with the mouse, the GDI snaps back into correct drawing, but as soon as I do something in the game that changes the GDI information displays, nothing updates properly. Does anyone have any idea what would cause this? I don't want to clutter up the question with massive source code pastes, but I can post some links to the files on SourceForge if it would help.