GLOverlayUI API Reference

CanvasDriver : The wxGLCanvas Wrapper

Kind of bridge for layout interaction and OpenGL render.

Copyright

(C) 2025 Umar Ba jUmarB@protonmail.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

class CanvasDriver : public wxGLCanvas
#include <canvasdriver.H>

Responsable to render OpenGL stuff on Canvas Frame layout

Public Functions

void apply_rotation(float rotation_angle)

apply rotation angle on all form

Parameters:

rotation_angle – - float

void apply_scaling(float scale)

apply scaling form

Parameters:

scale – - float

void apply_texture_button(const wxString &image)

load image for texture

Todo:

: investigate why the texture fail

related bug : at renderer.h (FIXME)

Parameters:

image – - image filename (PNG) format

CanvasDriver(wxWindow *mainframe_parent)

CanvasDriver constructor.

void CanvasDriver_init(void)

Initialize OpenGL stuff.

bool get_renderer_state(void)

get the renderer state

void increase_or_decrease_scaling(unsigned char)

increase or decrease scaling

Parameters:

symbole – - unsigned char should be “+” or “-”

void *mouse_motion_action_on(void (*what)(wxMouseEvent*, void *extradata), wxMouseEvent*)

Generic function to track mouse motion on canvas.

Parameters:
  • what – - A callback function that define the behavior it takes the mouse event and generic data

  • mouse – event object

Returns:

generic pointer

void renderer(int forms_bit_mask)

Renderer OpenGL frame.

Parameters:

forms_bit_mask – - Each form can be represented by a mask. please see the renderer.H file for more information

void set_renderer_state(bool state)

set the renderer state

Parameters:

state – - (true or false)

void sketch_map(int where = TOP_LEFT)

make kind of sketch mappin’ point to place the coordinate of each point

depending where the form should be appear

Parameters:

where – - the location ( TOP_LEFT , TOP_RIGHT ,BOTTOM_LEFT ,BOTTOM_RIGHT )

void toggle_renderer(void)

enable/disable the canvas renderering forms

virtual ~CanvasDriver()

CanvasDriver destructor.

Public Static Functions

static void overlay_button(wxMouseEvent *evt, void *metadata)

a specialized function to detecte mouse action on “button”

Parameters:
  • evt – - event mouse

  • metadata – - passed data to the function (it can be anything )

Private Members

bool _mouse_grab_state = false
Renderer _renderer

Detecte the mouse grab to trigger rotation on mouse motion

bool _show

Renderer instance

std::vector<float> button_area

The rendere state

GLuint texture

Hold the coords of “Button”.

struct motion_metadata
#include <canvasdriver.H>

specialized mouse motion data structure that embedded some needed data to draw and locate the frame button sketched on the canvas

Public Members

std::vector<float> _reference_coords

Hold the area size of the canvas

wxSize _size
void *status

coords reference you want to lookup