Skip to content

MapWinGIS6 ActiveX Control and Modern Rendering Architecture - #19

Merged
pmeems merged 3 commits into
developmentfrom
phase-5-initial-rendering-abstraction-opengl-backend
Oct 28, 2026
Merged

pmeems merged 3 commits into
developmentfrom
phase-5-initial-rendering-abstraction-opengl-backend

Conversation

@pmeems

@pmeems pmeems commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

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.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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
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 pmeems left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@pmeems
pmeems merged commit b071eb9 into development Oct 28, 2026
1 check passed
@pmeems
pmeems deleted the phase-5-initial-rendering-abstraction-opengl-backend branch October 28, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants