g4tools  5.4.0
Public Member Functions | Protected Attributes | List of all members
tools::sg::GL_viewer Class Reference
Inheritance diagram for tools::sg::GL_viewer:
Inheritance graph
[legend]
Collaboration diagram for tools::sg::GL_viewer:
Collaboration graph
[legend]

Public Member Functions

void render ()
 
 GL_viewer (std::ostream &a_out, unsigned int a_width, unsigned int a_height)
 
virtual ~GL_viewer ()
 
 GL_viewer (const GL_viewer &a_from)
 
GL_vieweroperator= (const GL_viewer &a_from)
 
- Public Member Functions inherited from tools::sg::viewer
virtual void * cast (const std::string &a_class) const
 
virtual void set_size (unsigned int a_w, unsigned int a_h)
 
virtual bool set_cursor_shape (cursor_shape)
 
 viewer (std::ostream &a_out, unsigned int a_width, unsigned int a_height)
 
virtual ~viewer ()
 
 viewer (const viewer &a_from)
 
vieweroperator= (const viewer &a_from)
 
bool set_default_cursor_shape ()
 
groupsg ()
 
const groupsg () const
 
unsigned int width () const
 
unsigned int height () const
 
bool screen2aspect (int a_x, int a_y, float &a_wx, float &a_wy) const
 
void set_clear_color (float a_r, float a_g, float a_b, float a_a=1)
 
void set_clear_color (const colorf &a_color)
 
void get_clear_color (float &a_r, float &a_g, float &a_b, float &a_a)
 
const colorfbackground () const
 
std::ostream & out () const
 
const std::string & out_dir () const
 
void set_produce_out_jpeg (bool a_value)
 
bool produce_out_jpeg () const
 
void set_produce_out_png (bool a_value)
 
bool produce_out_png () const
 
void set_produce_out_file (const std::string &a_file)
 
const std::string & produce_out_file () const
 
void set_produce_out_bpp (unsigned int a_bpp)
 
unsigned int produce_out_bpp () const
 

Protected Attributes

GL_manager m_gl_mgr
 
- Protected Attributes inherited from tools::sg::viewer
std::ostream & m_out
 
colorf m_clear_color
 
unsigned int m_ww
 
unsigned int m_wh
 
group m_sg
 
std::string m_out_dir
 
bool m_use_gsto
 
bool m_produce_out_jpeg
 
bool m_produce_out_png
 
std::string m_produce_out_file
 
unsigned int m_produce_out_bpp
 

Detailed Description

Definition at line 15 of file GL_viewer.

Constructor & Destructor Documentation

◆ GL_viewer() [1/2]

tools::sg::GL_viewer::GL_viewer ( std::ostream &  a_out,
unsigned int  a_width,
unsigned int  a_height 
)
inline

Definition at line 44 of file GL_viewer.

45  :parent(a_out,a_width,a_height)
46  ,m_gl_mgr(a_out)
47  {}

◆ ~GL_viewer()

virtual tools::sg::GL_viewer::~GL_viewer ( )
inlinevirtual

Definition at line 48 of file GL_viewer.

48  {
49  //WARNING : nodes may refer m_gl_mgr (to handle gstos/texs), then
50  // we have to delete them first.
51  m_sg.clear();
52  }

◆ GL_viewer() [2/2]

tools::sg::GL_viewer::GL_viewer ( const GL_viewer a_from)
inline

Definition at line 54 of file GL_viewer.

55  :parent(a_from)
56  ,m_gl_mgr(a_from.m_gl_mgr)
57  {}

Member Function Documentation

◆ operator=()

GL_viewer& tools::sg::GL_viewer::operator= ( const GL_viewer a_from)
inline

Definition at line 58 of file GL_viewer.

58  {
59  parent::operator=(a_from);
60  m_gl_mgr = a_from.m_gl_mgr;
61  return *this;
62  }

◆ render()

void tools::sg::GL_viewer::render ( )
inline

Definition at line 18 of file GL_viewer.

18  {
19  if(!m_ww) return;
20  if(!m_wh) return;
21 
23  m_clear_color.r(),
24  m_clear_color.g(),
25  m_clear_color.b(),
26  m_clear_color.a());
27 
28  GL_action action(m_gl_mgr,m_out,m_ww,m_wh);
29  action.state().m_use_gsto = m_use_gsto;
30 
31  m_sg.render(action);
32  if(!action.end()) { //check that matrices stack are ok.
33  m_out << "exib::sg::GL_viewer :"
34  << " bad gl_action end."
35  << std::endl;
36  }
37 
38  //after_render();
39 
41  }

Member Data Documentation

◆ m_gl_mgr

GL_manager tools::sg::GL_viewer::m_gl_mgr
protected

Definition at line 64 of file GL_viewer.


The documentation for this class was generated from the following file:
tools::sg::viewer::m_wh
unsigned int m_wh
Definition: viewer:172
tools::sg::GL_manager::begin_render
virtual bool begin_render(int a_x, int a_y, unsigned int a_ww, unsigned int a_wh, float a_r, float a_g, float a_b, float a_a, bool a_clear=true)
Definition: GL_manager:32
tools::sg::viewer::m_ww
unsigned int m_ww
Definition: viewer:171
tools::sg::viewer::m_use_gsto
bool m_use_gsto
Definition: viewer:175
tools::colorf::g
float g() const
Definition: colorf:33
tools::sg::group::render
virtual void render(render_action &a_action)
Definition: group:24
tools::sg::viewer::m_sg
group m_sg
Definition: viewer:173
tools::colorf::a
float a() const
Definition: colorf:35
tools::sg::GL_viewer::m_gl_mgr
GL_manager m_gl_mgr
Definition: GL_viewer:64
tools::sg::viewer::m_out
std::ostream & m_out
Definition: viewer:169
tools::sg::GL_manager::end_render
virtual void end_render()
Definition: GL_manager:203
tools::sg::group::clear
void clear()
Definition: group:235
tools::colorf::r
float r() const
Definition: colorf:32
tools::sg::viewer::m_clear_color
colorf m_clear_color
Definition: viewer:170
tools::colorf::b
float b() const
Definition: colorf:34