GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
opengl_selector Class Reference

#include "gl-select.h"

Inheritance diagram for opengl_selector:
Collaboration diagram for opengl_selector:

Public Member Functions

 opengl_selector (opengl_functions &glfcns)
 
virtual ~opengl_selector (void)=default
 
virtual void draw (const graphics_object &go, bool toplevel=true)
 
void draw (const Matrix &hlist, bool toplevel=false)
 
virtual void draw_zoom_box (int width, int height, int x1, int y1, int x2, int y2, const Matrix &overlaycolor, double overlayalpha, const Matrix &bordercolor, double borderalpha, double borderwidth)
 
virtual void finish (void)
 
opengl_functionsget_opengl_functions (void) const
 
virtual uint8NDArray get_pixels (int width, int height)
 
virtual graphics_xform get_transform (void) const
 
virtual Matrix get_viewport_scaled (void) const
 
graphics_object select (const graphics_object &ax, int x, int y, int flags=0)
 
virtual void set_device_pixel_ratio (double dpr)
 
virtual void set_viewport (int w, int h)
 

Protected Member Functions

virtual void change_marker (const std::string &m, double size)
 
virtual void draw_axes (const axes::properties &props)
 
virtual void draw_figure (const figure::properties &props)
 
virtual void draw_hggroup (const hggroup::properties &props)
 
virtual void draw_image (const image::properties &props)
 
virtual void draw_light (const light::properties &props)
 
virtual void draw_line (const line::properties &props)
 
virtual void draw_marker (double x, double y, double z, const Matrix &lc, const Matrix &fc, const double la=1.0, const double fa=1.0)
 
virtual void draw_patch (const patch::properties &props)
 
virtual void draw_scatter (const scatter::properties &props)
 
virtual void draw_surface (const surface::properties &props)
 
virtual void draw_text (const text::properties &props)
 
virtual void draw_text_background (const text::properties &props, bool do_rotate=false)
 
virtual void draw_uibuttongroup (const uibuttongroup::properties &props, const graphics_object &go)
 
virtual void draw_uipanel (const uipanel::properties &props, const graphics_object &go)
 
virtual void draw_zoom_rect (int x1, int y1, int x2, int y2)
 
virtual void end_marker (void)
 
virtual void init_gl_context (bool enhanced, const Matrix &backgroundColor)
 
virtual void init_marker (const std::string &m, double size, float width)
 
virtual void render_grid (const double linewidth, const std::string &gridstyle, const Matrix &gridcolor, const double gridalpha, const Matrix &ticks, double lim1, double lim2, double p1, double p1N, double p2, double p2N, int xyz, bool is_3D)
 
virtual Matrix render_text (const std::string &txt, double x, double y, double z, int halign, int valign, double rotation=0.0)
 
virtual void render_tickmarks (const Matrix &ticks, double lim1, double lim2, double p1, double p1N, double p2, double p2N, double dx, double dy, double dz, int xyz, bool doubleside)
 
virtual void render_ticktexts (const Matrix &ticks, const string_vector &ticklabels, double lim1, double lim2, double p1, double p2, int xyz, int ha, int va, int &wmax, int &hmax)
 
virtual void set_clipbox (double x1, double x2, double y1, double y2, double z1, double z2)
 
virtual void set_clipping (bool on)
 
virtual void set_color (const Matrix &c)
 
virtual void set_font (const base_properties &props)
 
virtual void set_interpreter (const caseless_str &interp)
 
virtual void set_linecap (const std::string &)
 
virtual void set_linejoin (const std::string &)
 
virtual void set_linestyle (const std::string &s, bool stipple=false, double linewidth=0.5)
 
virtual void set_linewidth (float w)
 
virtual void set_polygon_offset (bool on, float offset=0.0f)
 
virtual void set_selecting (bool on)
 
virtual void setup_opengl_transformation (const axes::properties &props)
 
virtual void text_to_pixels (const std::string &txt, uint8NDArray &pixels, Matrix &bbox, int halign=0, int valign=0, double rotation=0.0)
 
virtual void text_to_strlist (const std::string &txt, std::list< text_renderer::string > &lst, Matrix &bbox, int halign=0, int valign=0, double rotation=0.0)
 

Protected Attributes

double m_devpixratio
 
opengl_functionsm_glfcns
 
graphics_xform m_xform
 
double m_xmax
 
double m_xmin
 
double m_ymax
 
double m_ymin
 
double m_zmax
 
double m_zmin
 

Private Member Functions

void apply_pick_matrix (void)
 
uint8_t clip_code (double x, double y, double z) const
 
void draw_all_lights (const base_properties &props, std::list< graphics_object > &obj_list)
 
void draw_axes_boxes (const axes::properties &props)
 
void draw_axes_children (const axes::properties &props)
 
void draw_axes_grids (const axes::properties &props)
 
void draw_axes_planes (const axes::properties &props)
 
void draw_axes_x_grid (const axes::properties &props)
 
void draw_axes_y_grid (const axes::properties &props)
 
void draw_axes_z_grid (const axes::properties &props)
 
void draw_texture_image (const octave_value cdata, Matrix x, Matrix y, bool ortho=false)
 
void fake_text (double x, double y, double z, const Matrix &bbox, bool use_scale=true)
 
std::string get_string (unsigned int id) const
 
void init_maxlights (void)
 
bool is_nan_or_inf (double x, double y, double z) const
 
unsigned int make_marker_list (const std::string &m, double size, bool filled) const
 
double points_to_pixels (const double val) const
 
void restore_previous_coordinates (void)
 
void set_normal (int bfl_mode, const NDArray &n, int j, int i)
 
void set_ortho_coordinates (void)
 

Private Attributes

ColumnVector m_camera_dir
 
ColumnVector m_camera_pos
 
unsigned int m_current_light
 
unsigned int m_filled_marker_id
 
caseless_str m_interpreter
 
unsigned int m_marker_id
 
unsigned int m_max_lights
 
bool m_printing
 
bool m_selecting
 
graphics_toolkit m_toolkit
 
text_renderer m_txt_renderer
 
ColumnVector m_view_vector
 
double m_xZ1
 
double m_xZ2
 
std::map< GLuint, graphics_object > object_map
 
int size
 
int xp
 
int yp
 

Detailed Description

Definition at line 43 of file gl-select.h.

Constructor & Destructor Documentation

◆ opengl_selector()

opengl_selector::opengl_selector ( opengl_functions glfcns)
inline

Definition at line 46 of file gl-select.h.

◆ ~opengl_selector()

virtual opengl_selector::~opengl_selector ( void  )
virtualdefault

Member Function Documentation

◆ apply_pick_matrix()

◆ change_marker()

void opengl_renderer::change_marker ( const std::string &  m,
double  size 
)
protectedvirtualinherited

◆ clip_code()

uint8_t opengl_renderer::clip_code ( double  x,
double  y,
double  z 
) const
inlineprivateinherited

◆ draw() [1/2]

void opengl_selector::draw ( const graphics_object &  go,
bool  toplevel = true 
)
virtual

◆ draw() [2/2]

void opengl_renderer::draw ( const Matrix hlist,
bool  toplevel = false 
)
inherited

◆ draw_all_lights()

void opengl_renderer::draw_all_lights ( const base_properties &  props,
std::list< graphics_object > &  obj_list 
)
privateinherited

◆ draw_axes()

◆ draw_axes_boxes()

◆ draw_axes_children()

◆ draw_axes_grids()

◆ draw_axes_planes()

◆ draw_axes_x_grid()

◆ draw_axes_y_grid()

◆ draw_axes_z_grid()

◆ draw_figure()

void opengl_renderer::draw_figure ( const figure::properties &  props)
protectedvirtualinherited

◆ draw_hggroup()

void opengl_renderer::draw_hggroup ( const hggroup::properties &  props)
protectedvirtualinherited

Definition at line 3877 of file gl-render.cc.

References opengl_renderer::draw().

Referenced by opengl_renderer::draw().

◆ draw_image()

void opengl_selector::draw_image ( const image::properties &  props)
protectedvirtual

◆ draw_light()

void opengl_renderer::draw_light ( const light::properties &  props)
protectedvirtualinherited

◆ draw_line()

◆ draw_marker()

◆ draw_patch()

void opengl_renderer::draw_patch ( const patch::properties &  props)
protectedvirtualinherited

Definition at line 3186 of file gl-render.cc.

References opengl_tessellator::add_vertex(), opengl_tessellator::begin_contour(), opengl_tessellator::begin_polygon(), opengl_renderer::clip_code(), Array< T, Alloc >::columns(), Array< T, Alloc >::data(), opengl_renderer::draw_marker(), opengl_tessellator::end_contour(), opengl_renderer::end_marker(), opengl_tessellator::end_polygon(), f, FLAT, Array< T, Alloc >::fortran_vec(), opengl_functions::glBegin(), opengl_functions::glColor3dv(), opengl_functions::glColor4d(), opengl_functions::glDisable(), opengl_functions::glEnable(), opengl_functions::glEnd(), opengl_functions::glMaterialf(), opengl_functions::glMaterialfv(), opengl_functions::glShadeModel(), opengl_functions::glVertex3d(), GOURAUD, opengl_renderer::init_marker(), INTERP, opengl_renderer::is_nan_or_inf(), Array< T, Alloc >::isempty(), isnan(), LIGHT_MODE, m, vertex_data::vertex_data_rep::m_ambient, vertex_data::vertex_data_rep::m_color, vertex_data::vertex_data_rep::m_coords, vertex_data::vertex_data_rep::m_diffuse, opengl_renderer::m_glfcns, opengl_renderer::m_selecting, vertex_data::vertex_data_rep::m_specular, vertex_data::vertex_data_rep::m_specular_color_refl, opengl_renderer::m_view_vector, opengl_renderer::m_xform, Matrix, Array< T, Alloc >::numel(), panic_impossible, Matrix::resize(), Array< T, Alloc >::rows(), opengl_renderer::set_linecap(), opengl_renderer::set_linejoin(), opengl_renderer::set_linestyle(), opengl_renderer::set_linewidth(), UNIFORM, and warning().

Referenced by opengl_renderer::draw().

◆ draw_scatter()

◆ draw_surface()

◆ draw_text()

void opengl_selector::draw_text ( const text::properties &  props)
protectedvirtual

Reimplemented from opengl_renderer.

Definition at line 192 of file gl-select.cc.

References fake_text(), and Array< T, Alloc >::numel().

◆ draw_text_background()

◆ draw_texture_image()

◆ draw_uibuttongroup()

void opengl_renderer::draw_uibuttongroup ( const uibuttongroup::properties &  props,
const graphics_object &  go 
)
protectedvirtualinherited

◆ draw_uipanel()

void opengl_renderer::draw_uipanel ( const uipanel::properties &  props,
const graphics_object &  go 
)
protectedvirtualinherited

◆ draw_zoom_box()

void opengl_renderer::draw_zoom_box ( int  width,
int  height,
int  x1,
int  y1,
int  x2,
int  y2,
const Matrix overlaycolor,
double  overlayalpha,
const Matrix bordercolor,
double  borderalpha,
double  borderwidth 
)
virtualinherited

◆ draw_zoom_rect()

void opengl_renderer::draw_zoom_rect ( int  x1,
int  y1,
int  x2,
int  y2 
)
protectedvirtualinherited

◆ end_marker()

◆ fake_text()

void opengl_selector::fake_text ( double  x,
double  y,
double  z,
const Matrix bbox,
bool  use_scale = true 
)
private

◆ finish()

void opengl_renderer::finish ( void  )
virtualinherited

◆ get_opengl_functions()

opengl_functions& opengl_renderer::get_opengl_functions ( void  ) const
inlineinherited

Definition at line 54 of file gl-render.h.

◆ get_pixels()

◆ get_string()

std::string opengl_renderer::get_string ( unsigned int  id) const
privateinherited

◆ get_transform()

virtual graphics_xform opengl_renderer::get_transform ( void  ) const
inlinevirtualinherited

◆ get_viewport_scaled()

◆ init_gl_context()

◆ init_marker()

void opengl_selector::init_marker ( const std::string &  m,
double  size,
float  width 
)
protectedvirtual

Reimplemented from opengl_renderer.

Definition at line 70 of file gl-select.cc.

References apply_pick_matrix(), opengl_renderer::init_marker(), and m.

◆ init_maxlights()

void opengl_renderer::init_maxlights ( void  )
privateinherited

◆ is_nan_or_inf()

bool opengl_renderer::is_nan_or_inf ( double  x,
double  y,
double  z 
) const
inlineprivateinherited

Definition at line 187 of file gl-render.h.

References isinf(), isnan(), and x.

Referenced by opengl_renderer::draw_patch(), and opengl_renderer::draw_surface().

◆ make_marker_list()

◆ points_to_pixels()

double opengl_renderer::points_to_pixels ( const double  val) const
privateinherited

◆ render_grid()

void opengl_renderer::render_grid ( const double  linewidth,
const std::string &  gridstyle,
const Matrix gridcolor,
const double  gridalpha,
const Matrix ticks,
double  lim1,
double  lim2,
double  p1,
double  p1N,
double  p2,
double  p2N,
int  xyz,
bool  is_3D 
)
protectedvirtualinherited

◆ render_text()

Matrix opengl_selector::render_text ( const std::string &  txt,
double  x,
double  y,
double  z,
int  halign,
int  valign,
double  rotation = 0.0 
)
protectedvirtual

Reimplemented from opengl_renderer.

Definition at line 204 of file gl-select.cc.

References fake_text(), opengl_renderer::text_to_pixels(), and x.

◆ render_tickmarks()

void opengl_renderer::render_tickmarks ( const Matrix ticks,
double  lim1,
double  lim2,
double  p1,
double  p1N,
double  p2,
double  p2N,
double  dx,
double  dy,
double  dz,
int  xyz,
bool  doubleside 
)
protectedvirtualinherited

◆ render_ticktexts()

void opengl_renderer::render_ticktexts ( const Matrix ticks,
const string_vector ticklabels,
double  lim1,
double  lim2,
double  p1,
double  p2,
int  xyz,
int  ha,
int  va,
int &  wmax,
int &  hmax 
)
protectedvirtualinherited

◆ restore_previous_coordinates()

void opengl_renderer::restore_previous_coordinates ( void  )
privateinherited

◆ select()

graphics_object opengl_selector::select ( const graphics_object &  ax,
int  x,
int  y,
int  flags = 0 
)

◆ set_clipbox()

void opengl_renderer::set_clipbox ( double  x1,
double  x2,
double  y1,
double  y2,
double  z1,
double  z2 
)
protectedvirtualinherited

◆ set_clipping()

◆ set_color()

◆ set_device_pixel_ratio()

virtual void opengl_renderer::set_device_pixel_ratio ( double  dpr)
inlinevirtualinherited

Definition at line 64 of file gl-render.h.

◆ set_font()

void opengl_renderer::set_font ( const base_properties &  props)
protectedvirtualinherited

◆ set_interpreter()

virtual void opengl_renderer::set_interpreter ( const caseless_str interp)
inlineprotectedvirtualinherited

Definition at line 104 of file gl-render.h.

Referenced by opengl_renderer::draw_axes_grids().

◆ set_linecap()

virtual void opengl_renderer::set_linecap ( const std::string &  )
inlineprotectedvirtualinherited

◆ set_linejoin()

virtual void opengl_renderer::set_linejoin ( const std::string &  )
inlineprotectedvirtualinherited

◆ set_linestyle()

◆ set_linewidth()

◆ set_normal()

void opengl_renderer::set_normal ( int  bfl_mode,
const NDArray n,
int  j,
int  i 
)
privateinherited

◆ set_ortho_coordinates()

◆ set_polygon_offset()

◆ set_selecting()

virtual void opengl_renderer::set_selecting ( bool  on)
inlineprotectedvirtualinherited

Definition at line 114 of file gl-render.h.

Referenced by draw().

◆ set_viewport()

void opengl_renderer::set_viewport ( int  w,
int  h 
)
virtualinherited

◆ setup_opengl_transformation()

void opengl_selector::setup_opengl_transformation ( const axes::properties &  props)
protectedvirtual

Reimplemented from opengl_renderer.

Definition at line 63 of file gl-select.cc.

References apply_pick_matrix(), and opengl_renderer::setup_opengl_transformation().

◆ text_to_pixels()

void opengl_renderer::text_to_pixels ( const std::string &  txt,
uint8NDArray pixels,
Matrix bbox,
int  halign = 0,
int  valign = 0,
double  rotation = 0.0 
)
protectedvirtualinherited

◆ text_to_strlist()

void opengl_renderer::text_to_strlist ( const std::string &  txt,
std::list< text_renderer::string > &  lst,
Matrix bbox,
int  halign = 0,
int  valign = 0,
double  rotation = 0.0 
)
protectedvirtualinherited

Member Data Documentation

◆ m_camera_dir

ColumnVector opengl_renderer::m_camera_dir
privateinherited

Definition at line 248 of file gl-render.h.

◆ m_camera_pos

ColumnVector opengl_renderer::m_camera_pos
privateinherited

Definition at line 248 of file gl-render.h.

◆ m_current_light

unsigned int opengl_renderer::m_current_light
privateinherited

◆ m_devpixratio

◆ m_filled_marker_id

unsigned int opengl_renderer::m_filled_marker_id
privateinherited

◆ m_glfcns

opengl_functions& opengl_renderer::m_glfcns
protectedinherited

Definition at line 166 of file gl-render.h.

Referenced by apply_pick_matrix(), draw(), opengl_renderer::draw(), opengl_renderer::draw_axes(), opengl_renderer::draw_axes_boxes(), opengl_renderer::draw_axes_children(), opengl_renderer::draw_axes_grids(), opengl_renderer::draw_axes_planes(), opengl_renderer::draw_axes_x_grid(), opengl_renderer::draw_axes_y_grid(), draw_image(), opengl_renderer::draw_light(), opengl_renderer::draw_line(), opengl_renderer::draw_marker(), opengl_renderer::draw_patch(), opengl_renderer::draw_surface(), opengl_renderer::draw_text_background(), opengl_renderer::draw_texture_image(), opengl_renderer::draw_zoom_box(), opengl_renderer::draw_zoom_rect(), opengl_renderer::end_marker(), fake_text(), opengl_renderer::finish(), opengl_renderer::get_pixels(), opengl_renderer::get_string(), opengl_renderer::get_viewport_scaled(), opengl_renderer::init_gl_context(), opengl_renderer::init_marker(), opengl_renderer::init_maxlights(), opengl_renderer::make_marker_list(), opengl_renderer::render_grid(), opengl_renderer::render_text(), opengl_renderer::render_tickmarks(), opengl_renderer::restore_previous_coordinates(), select(), opengl_renderer::set_clipbox(), opengl_renderer::set_clipping(), opengl_renderer::set_color(), opengl_renderer::set_linestyle(), opengl_renderer::set_linewidth(), opengl_renderer::set_normal(), opengl_renderer::set_ortho_coordinates(), opengl_renderer::set_polygon_offset(), opengl_renderer::set_viewport(), and opengl_renderer::setup_opengl_transformation().

◆ m_interpreter

caseless_str opengl_renderer::m_interpreter
privateinherited

◆ m_marker_id

unsigned int opengl_renderer::m_marker_id
privateinherited

◆ m_max_lights

unsigned int opengl_renderer::m_max_lights
privateinherited

◆ m_printing

bool opengl_renderer::m_printing
privateinherited

Definition at line 263 of file gl-render.h.

Referenced by opengl_renderer::draw_figure(), and opengl_renderer::points_to_pixels().

◆ m_selecting

◆ m_toolkit

graphics_toolkit opengl_renderer::m_toolkit
privateinherited

Definition at line 239 of file gl-render.h.

Referenced by opengl_renderer::draw().

◆ m_txt_renderer

◆ m_view_vector

ColumnVector opengl_renderer::m_view_vector
privateinherited

◆ m_xform

◆ m_xmax

double opengl_renderer::m_xmax
protectedinherited

Definition at line 169 of file gl-render.h.

Referenced by opengl_renderer::set_clipbox().

◆ m_xmin

double opengl_renderer::m_xmin
protectedinherited

Definition at line 169 of file gl-render.h.

Referenced by opengl_renderer::set_clipbox().

◆ m_xZ1

double opengl_renderer::m_xZ1
privateinherited

◆ m_xZ2

double opengl_renderer::m_xZ2
privateinherited

◆ m_ymax

double opengl_renderer::m_ymax
protectedinherited

Definition at line 170 of file gl-render.h.

Referenced by opengl_renderer::set_clipbox().

◆ m_ymin

double opengl_renderer::m_ymin
protectedinherited

Definition at line 170 of file gl-render.h.

Referenced by opengl_renderer::set_clipbox().

◆ m_zmax

double opengl_renderer::m_zmax
protectedinherited

Definition at line 171 of file gl-render.h.

Referenced by opengl_renderer::draw_line(), and opengl_renderer::set_clipbox().

◆ m_zmin

double opengl_renderer::m_zmin
protectedinherited

Definition at line 171 of file gl-render.h.

Referenced by opengl_renderer::draw_line(), and opengl_renderer::set_clipbox().

◆ object_map

std::map<GLuint, graphics_object> opengl_selector::object_map
private

Definition at line 84 of file gl-select.h.

Referenced by draw(), and select().

◆ size

int opengl_selector::size
private

Definition at line 81 of file gl-select.h.

Referenced by apply_pick_matrix().

◆ xp

int opengl_selector::xp
private

Definition at line 78 of file gl-select.h.

Referenced by apply_pick_matrix(), and select().

◆ yp

int opengl_selector::yp
private

Definition at line 78 of file gl-select.h.

Referenced by apply_pick_matrix(), and select().


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