wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
Loading...
Searching...
No Matches
Functions
wxWidgets Embedding API

C API functions for hosting the BGI surface inside a wxGLCanvas. More...

Collaboration diagram for wxWidgets Embedding API:

Functions

BGI_API void BGI_CALL wxbgi_wx_char_event (int codepoint)
 Inject a Unicode character event into the BGI key queue.
 
BGI_API void BGI_CALL wxbgi_wx_get_size (int *width, int *height)
 Get the current BGI canvas dimensions.
 
BGI_API void BGI_CALL wxbgi_wx_init_for_canvas (int width, int height)
 Initialise BGI state for wxWidgets-embedded mode (no GLFW).
 
BGI_API void BGI_CALL wxbgi_wx_key_event (int glfwKey, int action)
 Inject a keyboard key press or release event into BGI.
 
BGI_API void BGI_CALL wxbgi_wx_mouse_button (int btn, int action)
 Inject a mouse-button press or release into BGI.
 
BGI_API void BGI_CALL wxbgi_wx_mouse_move (int x, int y)
 Inject a mouse-move event into BGI.
 
BGI_API void BGI_CALL wxbgi_wx_render_overlays_for_camera (const char *camName, int pageW, int pageH, int vpW, int vpH)
 Composite visual-aids overlays (grid, UCS axes, concentric circles, selection cursor) for a named camera ON TOP of the current GL content.
 
BGI_API void BGI_CALL wxbgi_wx_render_page_gl (int width, int height)
 Render the BGI pixel buffer using the currently active OpenGL context.
 
BGI_API void BGI_CALL wxbgi_wx_render_page_gl_vp (int pageW, int pageH, int vpW, int vpH)
 Render with separate page-buffer and physical-viewport dimensions.
 
BGI_API void BGI_CALL wxbgi_wx_resize (int width, int height)
 Notify BGI that the canvas has been resized.
 
BGI_API void BGI_CALL wxbgi_wx_scroll (double xDelta, double yDelta)
 Inject a scroll event into BGI.
 

Detailed Description

C API functions for hosting the BGI surface inside a wxGLCanvas.

These functions are used by WxBgiCanvas (and any custom GL canvas) to bridge the wx-side event handlers and the BGI state managed inside wx_bgi_opengl.dll. All locking is handled internally.

Function Documentation

◆ wxbgi_wx_char_event()

BGI_API void BGI_CALL wxbgi_wx_char_event ( int  codepoint)

Inject a Unicode character event into the BGI key queue.

Parameters
codepointUnicode code point (1-255).

◆ wxbgi_wx_get_size()

BGI_API void BGI_CALL wxbgi_wx_get_size ( int *  width,
int *  height 
)

Get the current BGI canvas dimensions.

◆ wxbgi_wx_init_for_canvas()

BGI_API void BGI_CALL wxbgi_wx_init_for_canvas ( int  width,
int  height 
)

Initialise BGI state for wxWidgets-embedded mode (no GLFW).

Call once from your WxBgiCanvas constructor or for headless testing. Allocates CPU page-buffers and registers the default camera/UCS. The actual GL context must already be current before calling wxbgi_wx_render_page_gl().

◆ wxbgi_wx_key_event()

BGI_API void BGI_CALL wxbgi_wx_key_event ( int  glfwKey,
int  action 
)

Inject a keyboard key press or release event into BGI.

Parameters
glfwKeyGLFW key code (or equivalent mapping).
action1 = press (WXBGI_KEY_PRESS), 0 = release (WXBGI_KEY_RELEASE).

◆ wxbgi_wx_mouse_button()

BGI_API void BGI_CALL wxbgi_wx_mouse_button ( int  btn,
int  action 
)

Inject a mouse-button press or release into BGI.

Parameters
btnWXBGI_MOUSE_LEFT / WXBGI_MOUSE_RIGHT / WXBGI_MOUSE_MIDDLE.
actionWXBGI_KEY_PRESS or WXBGI_KEY_RELEASE.

◆ wxbgi_wx_mouse_move()

BGI_API void BGI_CALL wxbgi_wx_mouse_move ( int  x,
int  y 
)

Inject a mouse-move event into BGI.

◆ wxbgi_wx_render_overlays_for_camera()

BGI_API void BGI_CALL wxbgi_wx_render_overlays_for_camera ( const char *  camName,
int  pageW,
int  pageH,
int  vpW,
int  vpH 
)

Composite visual-aids overlays (grid, UCS axes, concentric circles, selection cursor) for a named camera ON TOP of the current GL content.

Call from WxBgiCanvas::PostBlit() — i.e. after wxbgi_wx_render_page_gl_vp() and all 3-D solid/line GL passes — so overlays always appear in front of 3-D primitives.

The function clears the BGI page buffer to the background colour, redraws only the overlay geometry for camName, then alpha-blits the result with alpha=0 for background pixels (transparent) and alpha=255 for overlay pixels (opaque).

Parameters
camNameCamera to draw overlays for. NULL or "" = active camera.
pageW,pageHLogical BGI page dimensions.
vpW,vpHPhysical framebuffer (viewport) dimensions.

◆ wxbgi_wx_render_page_gl()

BGI_API void BGI_CALL wxbgi_wx_render_page_gl ( int  width,
int  height 
)

Render the BGI pixel buffer using the currently active OpenGL context.

Call from inside your OnPaint / EVT_PAINT handler, after SetCurrent(*glContext). Locks the BGI mutex internally.

◆ wxbgi_wx_render_page_gl_vp()

BGI_API void BGI_CALL wxbgi_wx_render_page_gl_vp ( int  pageW,
int  pageH,
int  vpW,
int  vpH 
)

Render with separate page-buffer and physical-viewport dimensions.

Like wxbgi_wx_render_page_gl but passes vpW × vpH to glViewport so the output fills the full physical framebuffer on high-DPI displays, while the page texture is still read at the logical pageW × pageH size.

◆ wxbgi_wx_resize()

BGI_API void BGI_CALL wxbgi_wx_resize ( int  width,
int  height 
)

Notify BGI that the canvas has been resized.

Call from EVT_SIZE. Reallocates page buffers for the new dimensions.

◆ wxbgi_wx_scroll()

BGI_API void BGI_CALL wxbgi_wx_scroll ( double  xDelta,
double  yDelta 
)

Inject a scroll event into BGI.

Parameters
xDeltaHorizontal scroll delta.
yDeltaVertical scroll delta (positive = scroll up).