wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
Loading...
Searching...
No Matches
wx_bgi_ext.h
Go to the documentation of this file.
1#pragma once
2
3#include "bgi_types.h"
4
24
33
39BGI_API const char *BGI_CALL wxbgi_font_name(int fontId);
40
47BGI_API int BGI_CALL wxbgi_font_id(const char *name);
48
85
95
106
107// ---------------------------------------------------------------------------
108// User Input Hook Callbacks
109// ---------------------------------------------------------------------------
110
137#define WXBGI_KEY_PRESS 1
138#define WXBGI_KEY_RELEASE 0
139#define WXBGI_KEY_REPEAT 2
140#define WXBGI_MOUSE_LEFT 0
141#define WXBGI_MOUSE_RIGHT 1
142#define WXBGI_MOUSE_MIDDLE 2
143#define WXBGI_MOD_SHIFT 0x0001
144#define WXBGI_MOD_CTRL 0x0002
145#define WXBGI_MOD_ALT 0x0004
147
161
172
182
196
206
225BGI_API void BGI_CALL wxbgi_get_scroll_delta(double *dx, double *dy);
226
256
263
287
290
299BGI_API int BGI_CALL wxbgi_hk_dds_get_selected_id(int index, char *outId, int maxLen);
300
306
313
320
323
337BGI_API int BGI_CALL wxbgi_hk_dds_pick_at(int x, int y, int ctrl);
338
348#ifdef WXBGI_ENABLE_TEST_SEAMS
368
383BGI_API int BGI_CALL wxbgi_test_simulate_key(int key, int scancode, int action, int mods);
384
396BGI_API int BGI_CALL wxbgi_test_simulate_char(unsigned int codepoint);
397
410
423BGI_API int BGI_CALL wxbgi_test_simulate_mouse_button(int button, int action, int mods);
424
436BGI_API int BGI_CALL wxbgi_test_simulate_scroll(double xoffset, double yoffset);
437#endif
450
469
476BGI_API int BGI_CALL wxbgi_get_window_size(int *width, int *height);
482BGI_API int BGI_CALL wxbgi_get_framebuffer_size(int *width, int *height);
489
501BGI_API void *BGI_CALL wxbgi_get_proc_address(const char *procName);
502
508BGI_API const char *BGI_CALL wxbgi_get_gl_string(int which);
509
517BGI_API int BGI_CALL wxbgi_begin_advanced_frame(float r, float g, float b, float a, int clearColor, int clearDepth);
524
531BGI_API int BGI_CALL wxbgi_read_pixels_rgba8(int x, int y, int width, int height, unsigned char *outBuffer, int outBufferSize);
532
540BGI_API int BGI_CALL wxbgi_write_pixels_rgba8(int x, int y, int width, int height, const unsigned char *inBuffer, int inBufferSize);
541
551#define WXBGI_FIELD_PALETTE_GRAYSCALE 0
552#define WXBGI_FIELD_PALETTE_VIRIDIS 1
553#define WXBGI_FIELD_PALETTE_INFERNO 2
554#define WXBGI_FIELD_PALETTE_TURBO 3
567 int cols, int rows,
568 const float *values, int valueCount,
569 int cellSizePx,
570 float minValue, float maxValue,
571 int paletteMode);
572
583 int cols, int rows,
584 const float *vectorsXY, int vectorCount,
585 int cellSizePx,
586 float scale,
587 int stride,
588 int color);
589
598 int width, int height,
599 float minValue, float maxValue,
600 int paletteMode,
601 const char *label);
602
612#define WXBGI_FIELD_PALETTE_GRAYSCALE 0
613#define WXBGI_FIELD_PALETTE_VIRIDIS 1
614#define WXBGI_FIELD_PALETTE_INFERNO 2
615#define WXBGI_FIELD_PALETTE_TURBO 3
630BGI_API int BGI_CALL wxbgi_field_draw_scalar_grid(int left, int top,
631 int cols, int rows,
632 const float *values, int valueCount,
633 int cellSizePx,
634 float minValue, float maxValue,
635 int paletteMode);
636
650BGI_API int BGI_CALL wxbgi_field_draw_vector_grid(int left, int top,
651 int cols, int rows,
652 const float *vectorsXY, int vectorCount,
653 int cellSizePx,
654 float scale,
655 int stride,
656 int color);
657
668 int width, int height,
669 float minValue, float maxValue,
670 int paletteMode,
671 const char *label);
672
683BGI_API int BGI_CALL wxbgi_define_color(int idx, int r, int g, int b);
684
694BGI_API int BGI_CALL wxbgi_alloc_color(int r, int g, int b);
695
703
715BGI_API void BGI_CALL wxbgi_getrgb(int color, int *r, int *g, int *b);
716
717
718
719// ---------------------------------------------------------------------------
720
721// PNG framebuffer export
722
723// ---------------------------------------------------------------------------
724
725
726
763BGI_API int BGI_CALL wxbgi_export_png(const char *filePath);
764
765
766
787BGI_API int BGI_CALL wxbgi_export_png_window(const char *filePath);
788
789
790
816
817 const char *filePath);
818
819
820
// wxbgi_export_api
822
840BGI_API void BGI_CALL wxbgi_wx_init_for_canvas(int width, int height);
841
848BGI_API void BGI_CALL wxbgi_wx_render_page_gl(int width, int height);
849
857BGI_API void BGI_CALL wxbgi_wx_render_page_gl_vp(int pageW, int pageH, int vpW, int vpH);
858
876 int pageW, int pageH,
877 int vpW, int vpH);
878
884BGI_API void BGI_CALL wxbgi_wx_resize(int width, int height);
885
889BGI_API void BGI_CALL wxbgi_wx_get_size(int* width, int* height);
890
897BGI_API void BGI_CALL wxbgi_wx_key_event(int glfwKey, int action);
898
905
910
917BGI_API void BGI_CALL wxbgi_wx_mouse_button(int btn, int action);
918
925BGI_API void BGI_CALL wxbgi_wx_scroll(double xDelta, double yDelta);
926
// wxbgi_wx_api
928
957
962BGI_API void BGI_CALL wxbgi_wx_frame_create(int width, int height, const char* title);
963
968
971
975
977typedef void (BGI_CALL *WxbgiFrameCallback)(void);
978
984
988
991
// wxbgi_standalone_api
993
// wxbgi_ext_api
#define BGI_CALL
Definition bgi_types.h:20
#define BGI_API
Definition bgi_types.h:14
BGI_API int BGI_CALL wxbgi_export_png_camera_view(const char *camName, const char *filePath)
Render the DDS scene through a camera and export its viewport to PNG.
BGI_API int BGI_CALL wxbgi_export_png_window(const char *filePath)
Export the full OpenGL window content to a PNG file.
BGI_API int BGI_CALL wxbgi_export_png(const char *filePath)
Export the current visual-page pixel buffer to a PNG file.
BGI_API int BGI_CALL wxbgi_make_context_current(void)
Makes the library OpenGL context current on this thread.
BGI_API int BGI_CALL wxbgi_read_pixels_rgba8(int x, int y, int width, int height, unsigned char *outBuffer, int outBufferSize)
Reads RGBA8 pixels from the current framebuffer.
BGI_API int BGI_CALL wxbgi_is_key_down(int key)
Queries whether a raw GLFW key code is currently held down.
BGI_API int BGI_CALL wxbgi_test_clear_key_queue(void)
Optional internal test seam APIs.
BGI_API int BGI_CALL wxbgi_swap_window_buffers(void)
Swaps front/back window buffers immediately.
BGI_API int BGI_CALL wxbgi_write_pixels_rgba8(int x, int y, int width, int height, const unsigned char *inBuffer, int inBufferSize)
Writes RGBA8 pixels into the current framebuffer.
BGI_API int BGI_CALL wxbgi_test_inject_key_code(int keyCode)
Internal test seam: injects one translated key code into the queue.
BGI_API int BGI_CALL wxbgi_field_draw_scalar_grid(int left, int top, int cols, int rows, const float *values, int valueCount, int cellSizePx, float minValue, float maxValue, int paletteMode)
Draw a 2-D scalar field as a false-colour grid into the active page buffer.
BGI_API int BGI_CALL wxbgi_end_advanced_frame(int swapBuffers)
Ends a manual frame.
BGI_API void BGI_CALL wxbgi_get_mouse_pos(int *x, int *y)
Returns the current mouse cursor position in window pixels.
BGI_API int BGI_CALL wxbgi_field_draw_vector_grid(int left, int top, int cols, int rows, const float *vectorsXY, int vectorCount, int cellSizePx, float scale, int stride, int color)
Draw a 2-D vector field as arrow glyphs into the active page buffer.
BGI_API void BGI_CALL wxbgi_request_close(void)
Requests closing the active graphics window.
BGI_API int BGI_CALL wxbgi_test_simulate_scroll(double xoffset, double yoffset)
Test seam: simulate the full scrollCallback pipeline.
BGI_API int BGI_CALL wxbgi_is_ready(void)
Checks whether advanced API operations can safely run.
BGI_API void BGI_CALL wxbgi_getrgb(int color, int *r, int *g, int *b)
Retrieves the RGB components of any colour index (0-255).
BGI_API int BGI_CALL wxbgi_poll_events(void)
Pumps pending OS/window events.
BGI_API int BGI_CALL wxbgi_key_pressed(void)
Reports whether a translated keyboard key event is pending.
BGI_API int BGI_CALL wxbgi_test_simulate_key(int key, int scancode, int action, int mods)
Test seam: simulate the full keyCallback pipeline.
BGI_API int BGI_CALL wxbgi_define_color(int idx, int r, int g, int b)
Assigns an RGB colour to a specific extended palette slot (index 16-255).
BGI_API int BGI_CALL wxbgi_test_inject_extended_scan(int scanCode)
Internal test seam: injects an extended DOS-style key sequence.
BGI_API int BGI_CALL wxbgi_set_vsync(int enabled)
Enables or disables vertical synchronization.
BGI_API double BGI_CALL wxbgi_get_time_seconds(void)
Returns the GLFW monotonic timer in seconds.
BGI_API int BGI_CALL wxbgi_test_simulate_cursor(int x, int y)
Test seam: simulate the full cursorPosCallback pipeline.
BGI_API int BGI_CALL wxbgi_mouse_moved(void)
Returns 1 if the mouse cursor moved since the last call to this function.
BGI_API int BGI_CALL wxbgi_test_simulate_char(unsigned int codepoint)
Test seam: simulate the full charCallback pipeline.
BGI_API void BGI_CALL wxbgi_free_color(int idx)
Releases an extended palette slot so it may be reused by wxbgi_alloc_color.
BGI_API int BGI_CALL wxbgi_get_framebuffer_size(int *width, int *height)
Retrieves framebuffer size in physical pixels.
BGI_API int BGI_CALL wxbgi_test_simulate_mouse_button(int button, int action, int mods)
Test seam: simulate the full mouseButtonCallback pipeline.
BGI_API int BGI_CALL wxbgi_set_window_title(const char *title)
Updates the native window title text.
BGI_API int BGI_CALL wxbgi_should_close(void)
Reports whether the window received a close request.
BGI_API int BGI_CALL wxbgi_begin_advanced_frame(float r, float g, float b, float a, int clearColor, int clearDepth)
Begins a manual OpenGL frame.
BGI_API int BGI_CALL wxbgi_get_window_size(int *width, int *height)
Retrieves window size in screen coordinates.
BGI_API const char *BGI_CALL wxbgi_get_gl_string(int which)
Returns OpenGL implementation strings.
BGI_API int BGI_CALL wxbgi_field_draw_scalar_legend(int left, int top, int width, int height, float minValue, float maxValue, int paletteMode, const char *label)
Draw a scalar legend bar with min/max labels.
BGI_API int BGI_CALL wxbgi_alloc_color(int r, int g, int b)
Allocates the next free extended palette slot and assigns it an RGB colour.
BGI_API int BGI_CALL wxbgi_read_key(void)
Reads the next translated keyboard event from the internal queue.
BGI_API void *BGI_CALL wxbgi_get_proc_address(const char *procName)
Resolves an OpenGL function pointer by symbol name.
BGI_API const char *BGI_CALL wxbgi_font_name(int fontId)
Returns the display name for a built-in font id.
BGI_API int BGI_CALL wxbgi_font_count(void)
Returns the number of built-in fonts known to the library.
BGI_API int BGI_CALL wxbgi_font_id(const char *name)
Resolves a built-in font name to its font id.
BGI_API int BGI_CALL wxbgi_hk_dds_is_selected(const char *id)
Returns 1 if the DDS object with the given ID is selected (hook-context safe).
BGI_API void BGI_CALL wxbgi_hk_dds_deselect_all(void)
Clears the entire DDS selection (hook-context safe).
BGI_API int BGI_CALL wxbgi_hk_dds_get_selected_id(int index, char *outId, int maxLen)
Copies the ID of the nth selected object into outId (hook-context safe).
BGI_API void BGI_CALL wxbgi_hk_dds_select(const char *id)
Adds the DDS object with the given ID to the selection (hook-context safe).
BGI_API void BGI_CALL wxbgi_hk_dds_deselect(const char *id)
Removes the DDS object with the given ID from the selection (hook-context safe).
BGI_API int BGI_CALL wxbgi_hk_get_mouse_y(void)
Returns the current mouse Y position (hook-context safe).
BGI_API int BGI_CALL wxbgi_hk_dds_pick_at(int x, int y, int ctrl)
Manually runs the DDS pick algorithm at screen position (x, y) and updates selectedObjectIds (hook-co...
BGI_API int BGI_CALL wxbgi_hk_dds_get_selected_count(void)
Returns the number of currently selected DDS objects (hook-context safe).
BGI_API int BGI_CALL wxbgi_hk_get_mouse_x(void)
Returns the current mouse X position (hook-context safe).
BGI_API void BGI_CALL wxbgi_set_input_defaults(int flags)
Sets the active input default-behavior flags.
BGI_API int BGI_CALL wxbgi_get_input_defaults(void)
Returns the current input default-behavior bitmask.
BGI_API void BGI_CALL wxbgi_set_scroll_hook(WxbgiScrollHook cb)
Registers a user hook invoked after each mouse scroll (wheel) event.
BGI_API void BGI_CALL wxbgi_set_char_hook(WxbgiCharHook cb)
Registers a user hook invoked after each printable character input event.
BGI_API void BGI_CALL wxbgi_set_cursor_pos_hook(WxbgiCursorPosHook cb)
Registers a user hook invoked after every cursor position update.
BGI_API void BGI_CALL wxbgi_set_mouse_button_hook(WxbgiMouseButtonHook cb)
Registers a user hook invoked after each mouse button press or release.
BGI_API void BGI_CALL wxbgi_set_key_hook(WxbgiKeyHook cb)
Registers a user hook invoked after each key press, repeat, or release.
void(BGI_CALL * WxbgiScrollHook)(double xoffset, double yoffset)
User hook fired after each mouse scroll (wheel) event.
Definition bgi_types.h:83
void(BGI_CALL * WxbgiCursorPosHook)(int x, int y)
User hook fired after every mouse cursor movement.
Definition bgi_types.h:65
void(BGI_CALL * WxbgiCharHook)(unsigned int codepoint)
User hook fired after each printable Unicode character input event.
Definition bgi_types.h:57
void(BGI_CALL * WxbgiKeyHook)(int key, int scancode, int action, int mods)
User hook fired after each key press, repeat, or release event.
Definition bgi_types.h:49
void(BGI_CALL * WxbgiMouseButtonHook)(int button, int action, int mods)
User hook fired after each mouse button press or release.
Definition bgi_types.h:74
BGI_API void BGI_CALL wxbgi_get_scroll_delta(double *dx, double *dy)
Reads and atomically clears the accumulated scroll deltas.
BGI_API void BGI_CALL wxbgi_wx_refresh(void)
Request an immediate canvas repaint.
BGI_API void BGI_CALL wxbgi_wx_app_create(void)
Create the wx application instance.
BGI_API void BGI_CALL wxbgi_wx_app_main_loop(void)
Run the wx event loop.
BGI_API void BGI_CALL wxbgi_wx_close_frame(void)
Close the standalone frame immediately.
BGI_API void BGI_CALL wxbgi_wx_set_frame_rate(int fps)
Set the auto-refresh rate in frames per second (default 0 = no auto-refresh).
void(BGI_CALL * WxbgiFrameCallback)(void)
Callback type for animation / per-frame update.
Definition wx_bgi_ext.h:977
BGI_API void BGI_CALL wxbgi_wx_set_idle_callback(WxbgiFrameCallback fn)
Register a per-frame callback.
BGI_API void BGI_CALL wxbgi_wx_close_after_ms(int ms)
Schedule the frame to close after ms milliseconds.
BGI_API void BGI_CALL wxbgi_wx_frame_create(int width, int height, const char *title)
Create a top-level wxFrame with an embedded WxBgiCanvas.
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_mouse_move(int x, int y)
Inject a mouse-move event into BGI.
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_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 cam...
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_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_get_size(int *width, int *height)
Get the current BGI canvas dimensions.
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_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_scroll(double xDelta, double yDelta)
Inject a scroll 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.