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

#include "gl-render.h"

Public Member Functions

 opengl_renderer (opengl_functions &glfcns)
 
virtual ~opengl_renderer ()=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 ()
 
opengl_functionsget_opengl_functions () const
 
virtual uint8NDArray get_pixels (int width, int height)
 
virtual graphics_xform get_transform () const
 
virtual Matrix get_viewport_scaled () const
 
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 ()
 
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
 

Detailed Description

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

Constructor & Destructor Documentation

◆ opengl_renderer()

opengl_renderer::opengl_renderer ( opengl_functions glfcns)

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

References err_disabled_feature(), and error().

◆ ~opengl_renderer()

virtual opengl_renderer::~opengl_renderer ( )
virtualdefault

Member Function Documentation

◆ change_marker()

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

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

References m, and panic_impossible.

Referenced by draw_scatter().

◆ draw() [1/2]

◆ draw() [2/2]

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

◆ draw_axes()

◆ draw_figure()

◆ draw_hggroup()

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

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

References draw(), and base_properties::get_children().

Referenced by draw().

◆ draw_image()

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

◆ draw_light()

◆ draw_line()

◆ draw_marker()

void opengl_renderer::draw_marker ( double  x,
double  y,
double  z,
const Matrix lc,
const Matrix fc,
const double  la = 1.0,
const double  fa = 1.0 
)
protectedvirtual

◆ draw_patch()

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

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

References patch::properties::backfacelighting_is(), Array< T, Alloc >::columns(), Array< T, Alloc >::data(), draw_marker(), patch::properties::edgealpha_is(), patch::properties::edgealpha_is_double(), patch::properties::edgecolor_is(), patch::properties::edgecolor_is_rgb(), patch::properties::edgelighting_is(), end_marker(), f, patch::properties::facealpha_is(), patch::properties::facealpha_is_double(), patch::properties::facecolor_is(), patch::properties::facecolor_is_rgb(), patch::properties::facelighting_is(), FLAT, patch::properties::get_ambientstrength(), patch::properties::get_color_data(), patch::properties::get_diffusestrength(), patch::properties::get_do_lighting(), patch::properties::get_edgealpha_double(), patch::properties::get_edgecolor_rgb(), patch::properties::get_facealpha_double(), patch::properties::get_facecolor_rgb(), patch::properties::get_facenormals(), patch::properties::get_faces(), patch::properties::get_linestyle(), patch::properties::get_linewidth(), patch::properties::get_marker(), patch::properties::get_markeredgecolor_rgb(), patch::properties::get_markerfacecolor_rgb(), patch::properties::get_markersize(), patch::properties::get_specularcolorreflectance(), patch::properties::get_specularexponent(), patch::properties::get_specularstrength(), patch::properties::get_vertexnormals(), patch::properties::get_vertices(), 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, patch::properties::has_bad_data(), init_marker(), INTERP, base_properties::is_clipping(), Array< T, Alloc >::isempty(), isnan(), LIGHT_MODE, patch::properties::linestyle_is(), m, patch::properties::m_coplanar_last_idx, m_glfcns, m_xform, patch::properties::marker_is(), patch::properties::markeredgecolor_is(), patch::properties::markerfacecolor_is(), octave_value::matrix_value(), Array< T, Alloc >::numel(), panic_impossible, base_properties::pickableparts_is(), Matrix::resize(), Array< T, Alloc >::rows(), graphics_xform::scale(), set_linecap(), set_linejoin(), set_linestyle(), set_linewidth(), UNIFORM, and warning().

Referenced by draw().

◆ draw_scatter()

◆ draw_surface()

void opengl_renderer::draw_surface ( const surface::properties props)
protectedvirtual

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

References octave_value::array_value(), surface::properties::backfacelighting_is(), Array< T, Alloc >::columns(), Array< T, Alloc >::data(), Array< T, Alloc >::dims(), draw_marker(), surface::properties::edgealpha_is(), surface::properties::edgealpha_is_double(), surface::properties::edgecolor_is(), surface::properties::edgecolor_is_rgb(), surface::properties::edgelighting_is(), end_marker(), surface::properties::facealpha_is(), surface::properties::facealpha_is_double(), surface::properties::facecolor_is(), surface::properties::facecolor_is_rgb(), surface::properties::facelighting_is(), FLAT, surface::properties::get_ambientstrength(), surface::properties::get_color_data(), surface::properties::get_diffusestrength(), surface::properties::get_do_lighting(), surface::properties::get_edgealpha_double(), surface::properties::get_edgecolor_rgb(), surface::properties::get_facealpha_double(), surface::properties::get_facecolor_rgb(), surface::properties::get_facenormals(), surface::properties::get_linestyle(), surface::properties::get_linewidth(), surface::properties::get_marker(), surface::properties::get_markeredgecolor_rgb(), surface::properties::get_markerfacecolor_rgb(), surface::properties::get_markersize(), surface::properties::get_specularcolorreflectance(), surface::properties::get_specularexponent(), surface::properties::get_specularstrength(), surface::properties::get_vertexnormals(), surface::properties::get_xdata(), surface::properties::get_ydata(), surface::properties::get_zdata(), opengl_functions::glBegin(), opengl_functions::glColor3dv(), opengl_functions::glColor3fv(), opengl_functions::glColor4d(), opengl_functions::glColor4fv(), opengl_functions::glDisable(), opengl_functions::glEnable(), opengl_functions::glEnd(), opengl_functions::glMaterialf(), opengl_functions::glMaterialfv(), opengl_functions::glShadeModel(), opengl_functions::glVertex3d(), GOURAUD, init_marker(), INTERP, base_properties::is_clipping(), Array< T, Alloc >::isempty(), isfinite(), LIGHT_MODE, surface::properties::linestyle_is(), m_glfcns, m_xform, surface::properties::marker_is(), surface::properties::markeredgecolor_is(), surface::properties::markerfacecolor_is(), octave_value::matrix_value(), surface::properties::meshstyle_is(), min(), panic_impossible, base_properties::pickableparts_is(), Array< T, Alloc >::rows(), set_linecap(), set_linejoin(), set_linestyle(), set_linewidth(), set_polygon_offset(), TEXTURE, UNIFORM, x, graphics_xform::xscale(), graphics_xform::yscale(), and graphics_xform::zscale().

Referenced by draw().

◆ draw_text()

◆ draw_text_background()

◆ draw_uibuttongroup()

◆ draw_uipanel()

◆ 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 
)
virtual

◆ draw_zoom_rect()

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

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

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

Referenced by draw_zoom_box().

◆ end_marker()

void opengl_renderer::end_marker ( )
protectedvirtual

◆ finish()

void opengl_renderer::finish ( )
virtual

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

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

◆ get_opengl_functions()

opengl_functions& opengl_renderer::get_opengl_functions ( ) const
inline

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

◆ get_pixels()

◆ get_transform()

virtual graphics_xform opengl_renderer::get_transform ( ) const
inlinevirtual

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

Referenced by draw_text_background().

◆ get_viewport_scaled()

Matrix opengl_renderer::get_viewport_scaled ( ) const
virtual

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

References opengl_functions::glGetIntegerv(), m_devpixratio, m_glfcns, and panic_impossible.

Referenced by init_marker().

◆ init_gl_context()

◆ init_marker()

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

◆ 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 
)
protectedvirtual

◆ render_text()

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

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

References text_renderer::ok(), panic_impossible, text_to_pixels(), and x.

Referenced by draw_text(), and render_ticktexts().

◆ 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 
)
protectedvirtual

◆ 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 
)
protectedvirtual

◆ set_clipbox()

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

◆ set_clipping()

void opengl_renderer::set_clipping ( bool  on)
protectedvirtual

◆ set_color()

void opengl_renderer::set_color ( const Matrix c)
protectedvirtual

◆ set_device_pixel_ratio()

virtual void opengl_renderer::set_device_pixel_ratio ( double  dpr)
inlinevirtual

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

◆ set_font()

void opengl_renderer::set_font ( const base_properties props)
protectedvirtual

◆ set_interpreter()

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

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

◆ set_linecap()

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

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

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

◆ set_linejoin()

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

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

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

◆ set_linestyle()

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

◆ set_linewidth()

void opengl_renderer::set_linewidth ( float  w)
protectedvirtual

◆ set_polygon_offset()

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

◆ set_selecting()

virtual void opengl_renderer::set_selecting ( bool  on)
inlineprotectedvirtual

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

◆ set_viewport()

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

◆ setup_opengl_transformation()

void opengl_renderer::setup_opengl_transformation ( const axes::properties props)
protectedvirtual

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

References axes::properties::get_transform_zlim(), and max().

Referenced by draw_axes().

◆ 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 
)
protectedvirtual

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

References text_renderer::text_to_pixels().

Referenced by render_text().

◆ 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 
)
protectedvirtual

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

References text_renderer::text_to_strlist().

Member Data Documentation

◆ m_devpixratio

double opengl_renderer::m_devpixratio
protected

◆ m_glfcns

◆ m_xform

graphics_xform opengl_renderer::m_xform
protected

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

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

◆ m_xmax

double opengl_renderer::m_xmax
protected

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

Referenced by set_clipbox().

◆ m_xmin

double opengl_renderer::m_xmin
protected

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

Referenced by set_clipbox().

◆ m_ymax

double opengl_renderer::m_ymax
protected

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

Referenced by set_clipbox().

◆ m_ymin

double opengl_renderer::m_ymin
protected

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

Referenced by set_clipbox().

◆ m_zmax

double opengl_renderer::m_zmax
protected

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

Referenced by draw_line(), and set_clipbox().

◆ m_zmin

double opengl_renderer::m_zmin
protected

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

Referenced by draw_line(), and set_clipbox().


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