pulsatrix
Loading...
Searching...
No Matches
pulsatrix::VizWindow Class Reference

Owns a GLFW window, OpenGL3 context, and ImGui/ImPlot context for the lifetime of one demo app. Every examples/viz/*_demo.cpp uses this instead of hand-rolling the standard imgui_impl_glfw_opengl3 boilerplate. More...

#include <window.hpp>

Public Member Functions

 VizWindow (const std::string &title, int width, int height)
 Creates the GLFW window, OpenGL3 context, and ImGui/ImPlot contexts.
 
 ~VizWindow ()
 
 VizWindow (const VizWindow &)=delete
 
VizWindow & operator= (const VizWindow &)=delete
 
void run (const std::function< void()> &draw_frame)
 Runs the main loop, calling draw_frame() once per frame between ImGui::NewFrame()/ImGui::Render(), until the window is closed.
 
void run (const std::function< void()> &draw_frame, const std::function< void(int, int)> &after_render)
 Same as run(draw_frame), plus after_render(framebuffer_width, framebuffer_height) called once per frame after ImGui's draw data has been rendered into the back buffer and before the buffer swap – the one point where glReadPixels sees the finished frame (e.g. for writing screenshots).
 
void request_close ()
 Asks the main loop to exit after the current frame (e.g. a scripted/screenshot run).
 

Detailed Description

Owns a GLFW window, OpenGL3 context, and ImGui/ImPlot context for the lifetime of one demo app. Every examples/viz/*_demo.cpp uses this instead of hand-rolling the standard imgui_impl_glfw_opengl3 boilerplate.

Note
This class – and everything that calls into ImGui or ImPlot – is deliberately NOT unit-tested via GoogleTest (see plans/okay-we-have-now-buzzing-moth.md Testing Strategy): a live window/GL context isn't meaningfully testable headlessly on this project's dev/CI machines. Verification is via manually running the demo apps.

Constructor & Destructor Documentation

◆ VizWindow() [1/2]

pulsatrix::VizWindow::VizWindow ( const std::string &  title,
int  width,
int  height 
)

Creates the GLFW window, OpenGL3 context, and ImGui/ImPlot contexts.

Exceptions
std::runtime_errorif GLFW initialization, window creation, or OpenGL loader setup fails – external boundary: availability of a display/GPU driver is environment-dependent, not an internal invariant.

◆ ~VizWindow()

pulsatrix::VizWindow::~VizWindow ( )

◆ VizWindow() [2/2]

pulsatrix::VizWindow::VizWindow ( const VizWindow &  )
delete

Member Function Documentation

◆ operator=()

VizWindow & pulsatrix::VizWindow::operator= ( const VizWindow &  )
delete

◆ request_close()

void pulsatrix::VizWindow::request_close ( )

Asks the main loop to exit after the current frame (e.g. a scripted/screenshot run).

◆ run() [1/2]

void pulsatrix::VizWindow::run ( const std::function< void()> &  draw_frame)

Runs the main loop, calling draw_frame() once per frame between ImGui::NewFrame()/ImGui::Render(), until the window is closed.

Parameters
draw_frameCaller-supplied per-frame drawing callback (ImGui/ImPlot calls only).

◆ run() [2/2]

void pulsatrix::VizWindow::run ( const std::function< void()> &  draw_frame,
const std::function< void(int, int)> &  after_render 
)

Same as run(draw_frame), plus after_render(framebuffer_width, framebuffer_height) called once per frame after ImGui's draw data has been rendered into the back buffer and before the buffer swap – the one point where glReadPixels sees the finished frame (e.g. for writing screenshots).


The documentation for this class was generated from the following file: