Shiokaze Framework
A research-oriented fluid solver for computer graphics
graphics_engine Class Referenceabstract

Interface for handling drawing operations. More...

#include <graphics_engine.h>

Inheritance diagram for graphics_engine:
graphics_interface

Public Types

enum  FEATURE { FEATURE::OPACITY, FEATURE::_3D }
 List of features that can be specified to get_supported(). More...
 
enum  MODE {
  MODE::POINTS, MODE::LINES, MODE::LINE_STRIP, MODE::LINE_LOOP,
  MODE::TRIANGLES, MODE::TRIANGLE_STRIP, MODE::TRIANGLE_FAN
}
 List of drawing mode that is to be specified with begin() function. See https://www.khronos.org/opengl/wiki/Primitive for detail. More...
 

Public Member Functions

virtual ~graphics_engine ()=default
 Default destructor.
 
virtual void setup_graphics (std::map< std::string, const void * > params=std::map< std::string, const void * >())=0
 Initialize graphics engine.
 
virtual std::string get_graphics_engine_name () const =0
 Get the name of the graphics engine. More...
 
virtual bool get_supported (FEATURE feature) const =0
 Get if a specified feature is supported. More...
 
virtual void set_viewport (unsigned x, unsigned y, unsigned width, unsigned height)=0
 Set view port.
 
virtual void get_viewport (unsigned &x, unsigned &y, unsigned &width, unsigned &height) const =0
 Get view port.
 
virtual void set_2D_coordinate (double left, double right, double bottom, double top)=0
 Configure 2D coordinate view. More...
 
virtual void look_at (const double target[3], const double position[3], const double up[3], double fov, double near, double far)=0
 Set up a camera with a target position, origin position and fov. More...
 
virtual void clear ()=0
 Clear out the canvas.
 
virtual void get_background_color (double color[3]) const =0
 Get the background color.
 
virtual void get_foreground_color (double color[3]) const =0
 Get the foreground color.
 
void color3 (double r, double g, double b)
 Equivalebt to glColor. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glColor.xml.
 
void color4 (double r, double g, double b, double a)
 Equivalebt to glColor. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glColor.xml.
 
template<class T >
void color3v (const T *v)
 Equivalebt to glColor. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glColor.xml.
 
virtual void color4v (const double *v)=0
 Equivalebt to glColor. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glColor.xml.
 
void color4v (const float *v)
 Equivalebt to glColor. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glColor.xml.
 
void vertex2 (double x, double y)
 Equivalebt to glVertex. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glVertex.xml.
 
void vertex3 (double x, double y, double z)
 Equivalebt to glVertex. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glVertex.xml.
 
virtual void begin (MODE mode)=0
 Equivalebt to glBegin. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glBegin.xml.
 
virtual void end ()=0
 Equivalebt to glEnd. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glEnd.xml.
 
virtual void point_size (double size)=0
 Equivalebt to glPointSize. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glPointSize.xml.
 
virtual void line_width (double width)=0
 Equivalebt to glLineWidth. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glLineWidth.xml.
 
template<class T >
void vertex2v (const T *v)
 Equivalebt to glVertex. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glVertex.xml.
 
virtual void vertex3v (const double *v)=0
 Equivalebt to glVertex. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glVertex.xml.
 
void vertex3v (const float *v)
 Equivalebt to glVertex. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glVertex.xml.
 
virtual void draw_string (const double *v, std::string str, unsigned size=0)=0
 Draw a string at the current position. More...
 

Detailed Description

Interface for handling drawing operations.

Member Enumeration Documentation

◆ FEATURE

List of features that can be specified to get_supported().

Enumerator
OPACITY 

Support for opacity (alpha) drawing.

_3D 

Support for 3D perspective.

◆ MODE

enum graphics_engine::MODE
strong

List of drawing mode that is to be specified with begin() function. See https://www.khronos.org/opengl/wiki/Primitive for detail.

Enumerator
POINTS 

Points.

LINES 

Independent lines segmemts.

LINE_STRIP 

Connected group of line segments.

LINE_LOOP 

Closed lines.

TRIANGLES 

Independent triangles.

TRIANGLE_STRIP 

Connected group of triangles.

TRIANGLE_FAN 

Connected group of triangles as fan.

Member Function Documentation

◆ draw_string()

virtual void graphics_engine::draw_string ( const double *  v,
std::string  str,
unsigned  size = 0 
)
pure virtual

Draw a string at the current position.

Parameters
[in]pPosition.
[in]strString.
[in]sizeString size.

◆ get_graphics_engine_name()

virtual std::string graphics_engine::get_graphics_engine_name ( ) const
pure virtual

Get the name of the graphics engine.

Returns
Name of the graphics engine.

◆ get_supported()

virtual bool graphics_engine::get_supported ( FEATURE  feature) const
pure virtual

Get if a specified feature is supported.

Parameters
[in]featureFeature to examine.
Returns
true if suppported false otherwise.

◆ look_at()

virtual void graphics_engine::look_at ( const double  target[3],
const double  position[3],
const double  up[3],
double  fov,
double  near,
double  far 
)
pure virtual

Set up a camera with a target position, origin position and fov.

Parameters
[in]targetTarget position.
[in]positionCamera position.
[in]topTop unit vector.
[in]fovField of view.
[in]nearNear clipping.
[in]farFar clipping.

◆ set_2D_coordinate()

virtual void graphics_engine::set_2D_coordinate ( double  left,
double  right,
double  bottom,
double  top 
)
pure virtual

Configure 2D coordinate view.

Parameters
[in]leftLeft edge x coordinate.
[in]rightRight edge x coordinate.
[in]bottomBottom edge y coordinate.
[in]topTop edge y coordinate.

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