GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave::opengl_renderer Class Reference

#include "gl-render.h"

Inheritance diagram for octave::opengl_renderer:
Collaboration diagram for octave::opengl_renderer:

Classes

class  patch_tessellator
 

Public Member Functions

 opengl_renderer (const opengl_renderer &)=delete
 
 opengl_renderer (opengl_functions &glfcns)
 
virtual ~opengl_renderer (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
 
opengl_rendereroperator= (const opengl_renderer &)=delete
 
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

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)
 
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 render_text (uint8NDArray pixels, Matrix bbox, double x, double y, double z, double rotation)
 
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
 

Detailed Description

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

Constructor & Destructor Documentation

◆ opengl_renderer() [1/2]

octave::opengl_renderer::opengl_renderer ( opengl_functions glfcns)

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

References err_disabled_feature(), and error().

◆ opengl_renderer() [2/2]

octave::opengl_renderer::opengl_renderer ( const opengl_renderer )
delete

◆ ~opengl_renderer()

virtual octave::opengl_renderer::~opengl_renderer ( void  )
virtualdefault

Member Function Documentation

◆ change_marker()

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

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

References m_filled_marker_id, m_marker_id, make_marker_list(), and panic_impossible.

Referenced by draw_scatter().

◆ clip_code()

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

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

References octave::is_nan_or_inf(), and x.

Referenced by draw_line(), draw_patch(), draw_scatter(), draw_surface(), and draw_text().

◆ draw() [1/2]

◆ draw() [2/2]

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

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

References octave::__get_gh_manager__(), draw(), len, and Array< T, Alloc >::numel().

◆ draw_all_lights()

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

◆ draw_axes()

void octave::opengl_renderer::draw_axes ( const axes::properties &  props)
protectedvirtual

◆ draw_axes_boxes()

void octave::opengl_renderer::draw_axes_boxes ( const axes::properties &  props)
private

◆ draw_axes_children()

void octave::opengl_renderer::draw_axes_children ( const axes::properties &  props)
private

◆ draw_axes_grids()

◆ draw_axes_planes()

void octave::opengl_renderer::draw_axes_planes ( const axes::properties &  props)
private

◆ draw_axes_x_grid()

◆ draw_axes_y_grid()

◆ draw_axes_z_grid()

void octave::opengl_renderer::draw_axes_z_grid ( const axes::properties &  props)
private

◆ draw_figure()

void octave::opengl_renderer::draw_figure ( const figure::properties &  props)
protectedvirtual

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

References draw(), get_string(), init_gl_context(), and m_printing.

Referenced by draw().

◆ draw_hggroup()

void octave::opengl_renderer::draw_hggroup ( const hggroup::properties &  props)
protectedvirtual

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

References draw().

Referenced by draw().

◆ draw_image()

void octave::opengl_renderer::draw_image ( const image::properties &  props)
protectedvirtual

Reimplemented in octave::opengl_selector.

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

References draw_texture_image(), panic_impossible, and x.

Referenced by draw().

◆ draw_light()

void octave::opengl_renderer::draw_light ( const light::properties &  props)
protectedvirtual

◆ draw_line()

◆ draw_marker()

◆ draw_patch()

void octave::opengl_renderer::draw_patch ( const patch::properties &  props)
protectedvirtual

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

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

Referenced by draw().

◆ draw_scatter()

void octave::opengl_renderer::draw_scatter ( const scatter::properties &  props)
protectedvirtual

◆ draw_surface()

◆ draw_text()

void octave::opengl_renderer::draw_text ( const text::properties &  props)
protectedvirtual

◆ draw_text_background()

◆ draw_texture_image()

◆ draw_uibuttongroup()

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

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

References draw(), init_gl_context(), and octave::Utils::properties().

Referenced by draw().

◆ draw_uipanel()

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

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

References draw(), init_gl_context(), and octave::Utils::properties().

Referenced by draw().

◆ draw_zoom_box()

◆ draw_zoom_rect()

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

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

References octave::opengl_functions::glVertex2d(), m_glfcns, and panic_impossible.

Referenced by draw_zoom_box().

◆ end_marker()

◆ finish()

void octave::opengl_renderer::finish ( void  )
virtual

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

References octave::opengl_functions::glFinish(), m_glfcns, and panic_impossible.

◆ get_opengl_functions()

opengl_functions & octave::opengl_renderer::get_opengl_functions ( void  ) const
inline

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

◆ get_pixels()

◆ get_string()

std::string octave::opengl_renderer::get_string ( unsigned int  id) const
private

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

References octave::opengl_functions::glGetString(), m_glfcns, and panic_impossible.

Referenced by draw_figure().

◆ get_transform()

virtual graphics_xform octave::opengl_renderer::get_transform ( void  ) const
inlinevirtual

◆ get_viewport_scaled()

Matrix octave::opengl_renderer::get_viewport_scaled ( void  ) const
virtual

◆ init_gl_context()

◆ init_marker()

◆ init_maxlights()

void octave::opengl_renderer::init_maxlights ( void  )
private

◆ is_nan_or_inf()

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

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

References octave::math::isinf(), octave::math::isnan(), and x.

Referenced by draw_patch(), and draw_surface().

◆ make_marker_list()

◆ operator=()

opengl_renderer & octave::opengl_renderer::operator= ( const opengl_renderer )
delete

◆ points_to_pixels()

double octave::opengl_renderer::points_to_pixels ( const double  val) const
private

◆ render_grid()

void octave::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 
)
protectedvirtual

◆ render_text() [1/2]

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

◆ render_text() [2/2]

◆ render_tickmarks()

void octave::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 
)
protectedvirtual

◆ render_ticktexts()

void octave::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 
)
protectedvirtual

◆ restore_previous_coordinates()

void octave::opengl_renderer::restore_previous_coordinates ( void  )
private

◆ set_clipbox()

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

◆ set_clipping()

void octave::opengl_renderer::set_clipping ( bool  on)
protectedvirtual

◆ set_color()

◆ set_device_pixel_ratio()

virtual void octave::opengl_renderer::set_device_pixel_ratio ( double  dpr)
inlinevirtual

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

Referenced by octave::GLCanvas::do_getPixels(), and octave::GLCanvas::draw().

◆ set_font()

void octave::opengl_renderer::set_font ( const base_properties &  props)
protectedvirtual

◆ set_interpreter()

virtual void octave::opengl_renderer::set_interpreter ( const caseless_str interp)
inlineprotectedvirtual

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

Referenced by draw_axes_grids().

◆ set_linecap()

virtual void octave::opengl_renderer::set_linecap ( const std::string &  )
inlineprotectedvirtual

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

Referenced by draw_axes_boxes(), draw_axes_grids(), draw_line(), draw_patch(), and draw_surface().

◆ set_linejoin()

virtual void octave::opengl_renderer::set_linejoin ( const std::string &  )
inlineprotectedvirtual

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

Referenced by draw_line(), draw_patch(), and draw_surface().

◆ set_linestyle()

void octave::opengl_renderer::set_linestyle ( const std::string &  s,
bool  stipple = false,
double  linewidth = 0.5 
)
protectedvirtual

◆ set_linewidth()

void octave::opengl_renderer::set_linewidth ( float  w)
protectedvirtual

◆ set_normal()

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

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

References d, octave::opengl_functions::glNormal3d(), m_glfcns, m_view_vector, panic_impossible, and x.

Referenced by draw_surface().

◆ set_ortho_coordinates()

◆ set_polygon_offset()

void octave::opengl_renderer::set_polygon_offset ( bool  on,
float  offset = 0.0f 
)
protectedvirtual

◆ set_selecting()

virtual void octave::opengl_renderer::set_selecting ( bool  on)
inlineprotectedvirtual

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

Referenced by octave::opengl_selector::draw().

◆ set_viewport()

void octave::opengl_renderer::set_viewport ( int  w,
int  h 
)
virtual

◆ setup_opengl_transformation()

◆ text_to_pixels()

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

◆ text_to_strlist()

void octave::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 
)
protectedvirtual

Member Data Documentation

◆ m_camera_dir

ColumnVector octave::opengl_renderer::m_camera_dir
private

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

◆ m_camera_pos

ColumnVector octave::opengl_renderer::m_camera_pos
private

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

◆ m_current_light

unsigned int octave::opengl_renderer::m_current_light
private

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

Referenced by draw_all_lights(), draw_axes_children(), and draw_light().

◆ m_devpixratio

double octave::opengl_renderer::m_devpixratio
protected

◆ m_filled_marker_id

unsigned int octave::opengl_renderer::m_filled_marker_id
private

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

Referenced by change_marker(), draw_marker(), end_marker(), and init_marker().

◆ m_glfcns

◆ m_interpreter

caseless_str octave::opengl_renderer::m_interpreter
private

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

Referenced by text_to_pixels(), and text_to_strlist().

◆ m_marker_id

unsigned int octave::opengl_renderer::m_marker_id
private

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

Referenced by change_marker(), draw_marker(), end_marker(), and init_marker().

◆ m_max_lights

unsigned int octave::opengl_renderer::m_max_lights
private

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

Referenced by draw_all_lights(), draw_axes_children(), and init_maxlights().

◆ m_printing

bool octave::opengl_renderer::m_printing
private

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

Referenced by draw_figure(), and points_to_pixels().

◆ m_selecting

bool octave::opengl_renderer::m_selecting
private

◆ m_toolkit

graphics_toolkit octave::opengl_renderer::m_toolkit
private

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

Referenced by draw().

◆ m_txt_renderer

text_renderer octave::opengl_renderer::m_txt_renderer
private

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

Referenced by render_text(), set_color(), set_font(), text_to_pixels(), and text_to_strlist().

◆ m_view_vector

ColumnVector octave::opengl_renderer::m_view_vector
private

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

Referenced by draw_axes_children(), draw_patch(), and set_normal().

◆ m_xform

graphics_xform octave::opengl_renderer::m_xform
protected

◆ m_xmax

double octave::opengl_renderer::m_xmax
protected

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

Referenced by set_clipbox().

◆ m_xmin

double octave::opengl_renderer::m_xmin
protected

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

Referenced by set_clipbox().

◆ m_xZ1

double octave::opengl_renderer::m_xZ1
private

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

Referenced by init_marker(), set_ortho_coordinates(), and setup_opengl_transformation().

◆ m_xZ2

double octave::opengl_renderer::m_xZ2
private

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

Referenced by init_marker(), set_ortho_coordinates(), and setup_opengl_transformation().

◆ m_ymax

double octave::opengl_renderer::m_ymax
protected

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

Referenced by set_clipbox().

◆ m_ymin

double octave::opengl_renderer::m_ymin
protected

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

Referenced by set_clipbox().

◆ m_zmax

double octave::opengl_renderer::m_zmax
protected

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

Referenced by draw_line(), and set_clipbox().

◆ m_zmin

double octave::opengl_renderer::m_zmin
protected

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

Referenced by draw_line(), and set_clipbox().


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