Repository navigation
MapWinGIS6 ActiveX Control and Modern Rendering Architecture - #19
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The hidden-window OpenGL target can produce blank or corrupt maps while reporting success, preventing GDI fallback and leaving a critical rendering defect unresolved.
5 open issues
Use an offscreen drawable instead of hidden window front buffer · New Restore the host OpenGL context after activation failure · New Reject or normalize consecutive duplicate polygon vertices · New Reject self-intersecting rings before selecting OpenGL · New Test OpenGL directly instead of masking regressions as skips · New
What changed in this PR
Introduces Phase 5’s rendering boundary within ActiveX while keeping GIS state and backend-neutral scene data in Core. OpenGL renders convex, single-ring polygons through a reusable WGL context, with GDI fallback for unsupported geometry or failures.
Changes:
- Splits rendering into a coordinator and separate OpenGL/GDI backends.
- Gives each control a persistent renderer; OpenGL reads pixels back before presentation rather than providing end-to-end acceleration.
- Adds renderer tests and documents architecture, limitations, and validation results.
Review validation included standalone geometry checks. Windows builds and rendering tests were not rerun.
| File | Description |
|---|---|
tests/MapWinGIS.Core.Tests/VectorLayerRendererTests.cpp |
Adds OpenGL pixel checks and interior-ring fallback coverage. |
tests/MapWinGIS.Core.Tests/MapWinGIS.Core.Tests.vcxproj |
Includes renderer sources and tests. |
src/MapWinGIS.ActiveX/VectorRenderBackend.h |
Defines the internal backend contract and identifiers. |
src/MapWinGIS.ActiveX/VectorLayerRenderer.h |
Declares the coordinator and backend state. |
src/MapWinGIS.ActiveX/VectorLayerRenderer.cpp |
Selects OpenGL and falls back to GDI. |
src/MapWinGIS.ActiveX/OpenGlVectorLayerRenderer.h |
Declares reusable WGL resources and pixel buffers. |
src/MapWinGIS.ActiveX/OpenGlVectorLayerRenderer.cpp |
Implements geometry checks, OpenGL drawing, and pixel presentation. |
src/MapWinGIS.ActiveX/MapWinGISControl.h |
Adds a persistent renderer to the control. |
src/MapWinGIS.ActiveX/MapWinGISControl.cpp |
Routes drawing through the coordinator. |
src/MapWinGIS.ActiveX/MapWinGIS.ActiveX.vcxproj |
Registers the backend source and header files. |
src/MapWinGIS.ActiveX/GdiVectorLayerRenderer.h |
Declares the GDI fallback backend. |
src/MapWinGIS.ActiveX/GdiVectorLayerRenderer.cpp |
Extracts the existing GDI polygon renderer. |
docs/TESTING.md |
Records renderer validation and pending interactive checks. |
docs/ARCHITECTURE.md |
Documents backend responsibilities and remaining limitations. |
Review effort: Balanced
- Draw into a framebuffer object instead of a hidden window's front buffer, returning S_FALSE when framebuffer objects are unavailable. - Always restore the caller's WGL context, even if activation fails. - Ignore consecutive duplicate vertices and reject spikes and self-intersecting rings before choosing OpenGL. - Test the OpenGL backend directly and add geometry regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pmeems
left a comment
There was a problem hiding this comment.
Follow-up review of the updated commit a95d102: the five earlier review findings appear addressed. I found one additional robustness issue in the fallback path.
Validate every vertex's device coordinates before drawing so NaN, infinite, or overflowing values fail the scene with E_INVALIDARG instead of reaching std::lround and the LONG conversion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>


Adds Phase 5's rendering boundary so backend selection stays inside the ActiveX layer and GIS state remains in Core. The control now tries a reusable WGL/OpenGL 1.1 backend for convex, hole-free polygons and falls back to GDI for unsupported geometry or rendering failures. OpenGL pixels are read back before presentation, so this is not an end-to-end accelerated path. No new package dependency; it uses the Windows system OpenGL library.
The Debug x64 solution build passed with no compiler warnings, and the native suite passed 138 tests (2 skipped); both new renderer tests passed. The managed host activated, loaded, and resized, but screen-pixel checks need rerunning on an interactive desktop because its window was absent from this session's desktop capture.