Add render_gl.cpp (selectable as `gl`): renders the animated pattern with scissored clears (glClear + glScissor -- GL 1.1, exported straight from opengl32) and presents with SwapBuffers. No glad/submodule needed: a legacy wglCreateContext + <GL/gl.h> suffices, so the planned loader dependency was dropped. GL is bottom-left origin and the capture flips top-down, so the frame-counter block is drawn at the GL top to land top-left in the captured image. Window class gains CS_OWNDC for a stable GL DC; best-effort vsync via a runtime wglSwapIntervalEXT lookup. The GL SwapBuffers/wglSwapBuffers hook now bumps the shared present counter (it's the GL present), so present_calls works for GL games too. mock_game_test decodes GL frames through the existing glReadPixels capture path; 15/15 ctest. Roadmap: OpenGL milestone done and removed (Vulkan renumbered to M2); architecture/lessons/test docs updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
36 lines
572 B
C++
36 lines
572 B
C++
#include "render_backend.hpp"
|
|
|
|
namespace coop::mock
|
|
{
|
|
|
|
std::unique_ptr<RenderBackend> RenderBackend::create(const std::string& name)
|
|
{
|
|
if (name == "dx11")
|
|
{
|
|
return create_dx11_backend();
|
|
}
|
|
if (name == "dx12")
|
|
{
|
|
return create_dx12_backend();
|
|
}
|
|
if (name == "dx10")
|
|
{
|
|
return create_dx10_backend();
|
|
}
|
|
if (name == "dx9ex")
|
|
{
|
|
return create_dx9_backend(/*ex=*/true);
|
|
}
|
|
if (name == "dx9")
|
|
{
|
|
return create_dx9_backend(/*ex=*/false);
|
|
}
|
|
if (name == "gl" || name == "opengl")
|
|
{
|
|
return create_gl_backend();
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
} // namespace coop::mock
|