MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
MGOpenGLView クラス

Defines OpenGL display class for MGCL objects. [詳解]

公開メンバ関数

 MGOpenGLView (bool perspective=true)
 
 MGOpenGLView (const MGglViewAttrib &glatr)
 Construct from MGglViewAttrib. [詳解]
 
virtual ~MGOpenGLView ()
 
int attach_drawer (mgVBO *drawer, bool common=true)
 
void detach_drawer (mgVBO *drawer, bool common=true)
 Detach the atttached mgVBO. [詳解]
 
void copy (const MGOpenGLView &glview2)
 
void copy (const MGglViewAttrib &glatr)
 copy the attributes in glatr into this. [詳解]
 
const MGColorBcolor () const
 
const MGColorGcolor () const
 
const MGPositioncenter () const
 return the center of the box of this view. [詳解]
 
const MGConstructionPlanecplane () const
 
MGConstructionPlanecplane ()
 
bool DeleteDisplayList_by_function (int fc)
 delete system display list by the function code. [詳解]
 
bool DeleteDisplayList_by_function_object_code (int fc, const MGGel *gel)
 
double diameter () const
 Obtainthe the diameter of the sphere that surround the whole model. [詳解]
 
const MGDrawParamdraw_param () const
 
MGDrawParamdraw_param ()
 
int line_density () const
 Return line density for a surface to draw in wire mode. [詳解]
 
void execDefaultStaticAttrib ()
 
void drawScene (const MGPickObjects *pobjs=0)
 
void enable_grid_snap (bool bEnabled)
 
const MGPositioneye_position () const
 Get the eye position. [詳解]
 
void get_model_matrix (glm::mat4 &modelMat) const
 get ModelView matrix of OpenGL. [詳解]
 
void get_projection_matrix (const int vp[4], glm::mat4 &projMat) const
 get projection matrix, given the viewport data [詳解]
 
bool get_surface_parameter_glv (const MGFSurface &surf, int sx, int sy, MGPosition &uv) const
 
mgSysGLgetSysGLByFunctionCode (int fc)
 
void get_viewport (glm::ivec4 &vp) const
 get viewport of OpenGL. [詳解]
 
void get_viewport (int vp[4]) const
 
void get_window (int &width, int &height) const
 get window(m_width, m_height); [詳解]
 
HDC getHDC () const
 Get redering context. [詳解]
 
HGLRC getRC () const
 Get redering context. [詳解]
 
MGOpenGLViewget_parent_OpenGLView ()
 Set the parent MGOpenGLView. [詳解]
 
const MGOpenGLViewget_parent_OpenGLView () const
 
bool has_parent_OpenGLView () const
 
bool has_display_list () const
 Test if this has a display list to draw. [詳解]
 
void home ()
 Transform to the home position. [詳解]
 
void import_context (const MGContext &ctx)
 Import MGOpenGLView data from MGContext. [詳解]
 
void importViewAttribFromContext (const MGContext &ctx)
 
void importDrawAttribFromContext (const MGContext &ctx)
 
void importGridAttrib (const MGContext &ctx)
 
void initializeViewingEnvironmentByBox (const MGBox &box)
 
void initialize_viewing_environment (const MGPlane &plane, double diameter, bool rotate=false)
 
bool is_enabled_grid_snap () const
 
bool is_perspective () const
 Return if this is a perspective view or not. [詳解]
 
MGPosition locate_glv (int x, int y, MGPosition *uv=0) const
 
void make_construction_plane (const MGPosition &mid, const MGVector &uderi, const MGVector &vderi, double uspan, double vspan, int ulnum, int lnum)
 
void make_display_list (const MGContext &ctx, const MGGroup &grp)
 
void mglTranslate (const glm::vec3 &vec)
 
void mglRotate (float angle, const glm::vec3 &axis)
 
void mglScale (const glm::vec3 &factor)
 angle's unit is degree. [詳解]
 
void pan_zoom (int x0, int y0, int x1, int y1)
 
void pan_zoom (const MGBox &box)
 
MGPickObjects pick_glv (const float center[2], float aperturex=-1., float aperturey=-1., const MGAbstractGels &objtype=mgAll_Object)
 
int pick_start_end_glv (const MGCurve &curve, int sx, int sy)
 
int pick_perimeter_glv (const MGSurface &surf, int sx, int sy, MGPosition *uv=0, float aperturex=-1., float aperturey=-1.)
 
const MGEdgepick_edge_glv (const MGFace &f, int sx, int sy, MGPosition *uv=0, float aperturex=-1., float aperturey=-1.)
 
float pick_aperture () const
 Get the pick aperture. [詳解]
 
int pick_to_select_buf (const float center[2], const float delta[2], mgVBO *display_list, std::set< unsigned > &selected)
 Function's return value is the number of hit objects. [詳解]
 
void project (const MGPosition &world, MGPosition &screen, const glm::mat4 *modelMat=0, const glm::mat4 *projlMat=0, const glm::ivec4 *vp=0) const
 
mgSysGLpush_back_to_sysgl (int fc, const MGGel *oi=0)
 
mgSysGLpush_front_to_sysgl (int fc, const MGGel *oi=0)
 
void push_back_to_sysgl (mgSysGL *sysgl)
 
void rotate (float angle, float x, float y, float z)
 
void rotate (float angle, float vector[3], const MGPosition &center)
 
void rotate (const float angle[2])
 
void scale (double factor, int *center=0)
 Scale the current view by the factor and the view center. [詳解]
 
void set_center (const MGPosition &pos)
 
void set_center_current (int x, int y)
 
void set_line_density (int line_density=1)
 Set line density for a surface to draw in wire mode. [詳解]
 
void setDrawParam (const MGContext &ctx)
 
void setProjectionMat2GLSL (bool initialize=false)
 
void setModelViewMat2GLSL ()
 Set Model_View matrix of OpenGL(setUniform). [詳解]
 
void setNdcMat2GLSL ()
 Set ndc factors. [詳解]
 
void set_output_dpi (float dpi)
 
float get_output_dpi ()
 
void setDpiFactor2GLSL ()
 
void setEyePositionUpVector (const MGPosition &eyeP, const MGVector &upVector)
 Set m_eyeP and m_up_vector(the eye position and view-up-vector of the OpenGL). [詳解]
 
void set_parent_OpenGLView (MGOpenGLView *parent=0)
 Set the parent MGOpenGLView. [詳解]
 
void setBcolor (const MGColor &color)
 Set background color;. [詳解]
 
void set_fovy (double fovy)
 
void setGcolor (const MGColor &color)
 Set default object color;. [詳解]
 
void set_pick_aperture (double pick_aperture)
 
void set_pick_aperture (float pick_aperture)
 
void set_smooth (float smooth)
 set the smooth factor of this view. [詳解]
 
void set_window (int width, int height)
 
void setProjModelViewMat2GLSL ()
 Set ProjModelView matrix to GLSL using setUniform();. [詳解]
 
float smooth () const
 Get the smooth factor of this view. [詳解]
 
double span_length () const
 Get the draw span length(approximate line segment length to draw curves). [詳解]
 
void translate (double dx, double dy)
 Translate the current view by (dx, dy). [詳解]
 
void translate_without_scale (double dx, double dy)
 Translate the current view by (dx, dy) without current scale. [詳解]
 
void unproject (int x, int y, MGStraight &sl, MGCSisect &is) const
 
void unproject_to_sl_glv (int x, int y, MGStraight &sl) const
 
const MGVectorview_up_vector () const
 Get the view up vector. [詳解]
 
double view_volume_far () const
 compute the view volume far. [詳解]
 
double view_volume_height () const
 compute the view volume height. [詳解]
 
double view_volume_near () const
 compute the view volume near. [詳解]
 
double get_scale ()
 
void get_near_position (const MGCurve *crv, const float center[2], double &t)
 
mgVBOdisplay_list ()
 Return display list name that shows all of the objects in this view. [詳解]
 
void set_display_list (mgVBO *dlist)
 Update display list name that shows all of the objects in this view. [詳解]
 
void setViewMode (MGCL::VIEWMODE vmode=MGCL::WIRE)
 Set view mode. [詳解]
 
void makeRCCurrent () const
 
void setDCRC (HDC dc, HGLRC rc)
 Set redering context. [詳解]
 
void setupDrawEnv (const MGColor &backColor, bool selection=false)
 Set up drawing environment. [詳解]
 
void screen_to_world (int wh[2], double sx, double sy, double &wx, double &wy) const
 
const MGglViewAttribviewAttrib () const
 
MGglViewAttribviewAttrib ()
 
MGCL::VIEWMODE viewMode () const
 

静的公開メンバ関数

static const MGColorHcolor ()
 
static MGOpenGLViewgetCurrentOpenGLView ()
 Get the current active MGOpenGLView. [詳解]
 
static void setHcolor (const MGColor &color)
 Set hilight color;. [詳解]
 

公開変数類

mgSysGLList m_sysgllist
 System display list manager. [詳解]
 

限定公開メンバ関数

void highlight (const MGPickObjects *pobjsP)
 
void set_perspective (bool pers, double fovy=45.)
 Set if this view is a perspective view(true), or orthnormal view(false). [詳解]
 

限定公開変数類

int m_width
 アトリビュート [詳解]
 
int m_height
 
MGOpenGLViewm_parent_glView
 0. [詳解]
 
mgVBOm_display_list
 
HGLRC m_hRC
 Rendering context. [詳解]
 
HDC m_hDC
 Device Context. [詳解]
 
MGColor m_Bcolor
 Background color. [詳解]
 
MGColor m_Gcolor
 Object lines color. [詳解]
 
float m_smooth
 
float m_pick_aperture
 Pick aperture. Number of pixels to allow picking. [詳解]
 
MGglViewAttrib m_viewAttrib
 Attributes that are saved to .mgl file. [詳解]
 
glm::mat4 m_lookAtMat
 and view_up_vector(). [詳解]
 
glm::vec3 m_XAxis_current
 the current unprojected straight line of the input cursor is set. [詳解]
 
glm::vec3 m_center_current
 Current center after transformations(a point on m_unprojectSL_current). [詳解]
 
glm::vec3 m_up_vector_current
 
glm::mat4 m_projMat
 
float m_dpi
 Projection matrix to set into uniform. [詳解]
 

詳解

Defines OpenGL display class for MGCL objects.

MGOpenGLView provides various functions to draw or render pictures of MGCL objects in MFC's CGLView windows.

構築子と解体子

MGOpenGLView::MGOpenGLView ( bool  perspective = true)
引数
perspectiveindicates if the view is pespective or not.
MGOpenGLView::MGOpenGLView ( const MGglViewAttrib glatr)

Construct from MGglViewAttrib.

virtual MGOpenGLView::~MGOpenGLView ( )
virtual

関数詳解

int MGOpenGLView::attach_drawer ( mgVBO drawer,
bool  common = true 
)

Attach to VBO reference to Command Drawer list. Function's return value is the number of drawer's attached after attached.

引数
drawerThe target graphic object.
commonif true, drawer is attachd as common picture for all the sibling window. if flase, drawer is attached to this specific pictures.
const MGColor& MGOpenGLView::Bcolor ( ) const

Get color values, Bcolor:background color, Gcolor:Object color, Hcolor:hilighted object color of this OpenGLView.

const MGPosition& MGOpenGLView::center ( ) const
inline

return the center of the box of this view.

void MGOpenGLView::copy ( const MGOpenGLView glview2)

Copy the informations of glview2 into this. Data that is not copied from glview2 are: m_sysgllist. m_hRC and m_hDC can be set using setDCRC(). m_sysgllist must be made by invoking openGL's display list generation functions.

void MGOpenGLView::copy ( const MGglViewAttrib glatr)

copy the attributes in glatr into this.

const MGConstructionPlane& MGOpenGLView::cplane ( ) const
inline
MGConstructionPlane& MGOpenGLView::cplane ( )
inline
bool MGOpenGLView::DeleteDisplayList_by_function ( int  fc)
inline

delete system display list by the function code.

bool MGOpenGLView::DeleteDisplayList_by_function_object_code ( int  fc,
const MGGel gel 
)
inline
void MGOpenGLView::detach_drawer ( mgVBO drawer,
bool  common = true 
)

Detach the atttached mgVBO.

引数
drawerThe target graphic object.
commonif true, drawer is attachd as common picture for all the sibling window. if flase, drawer is attached to this specific pictures.
double MGOpenGLView::diameter ( ) const
inline

Obtainthe the diameter of the sphere that surround the whole model.

mgVBO* MGOpenGLView::display_list ( )

Return display list name that shows all of the objects in this view.

const MGDrawParam& MGOpenGLView::draw_param ( ) const
MGDrawParam& MGOpenGLView::draw_param ( )
void MGOpenGLView::drawScene ( const MGPickObjects pobjs = 0)

Draw the scene defined in this view including the current objects as hilighted. drawScene will invoke makeRCCurrent();

void MGOpenGLView::enable_grid_snap ( bool  bEnabled)

Enable when bEnabled=true, else disable grid snap. When bEnabled=true, cpnlane is enbaled.

void MGOpenGLView::execDefaultStaticAttrib ( )
const MGPosition& MGOpenGLView::eye_position ( ) const
inline

Get the eye position.

const MGColor& MGOpenGLView::Gcolor ( ) const
void MGOpenGLView::get_model_matrix ( glm::mat4 &  modelMat) const

get ModelView matrix of OpenGL.

void MGOpenGLView::get_near_position ( const MGCurve crv,
const float  center[2],
double &  t 
)

Compute the nearest point parameter value of crv to the point center. center's data is given by the screen coordinate of this current screen.

引数
crvTarget curve.
centerscreen coordinates whose origin is (left, bottom).
tparameter value of the curve crv near to (sx,sy) will be returned.
float MGOpenGLView::get_output_dpi ( )
inline
MGOpenGLView* MGOpenGLView::get_parent_OpenGLView ( )
inline

Set the parent MGOpenGLView.

const MGOpenGLView* MGOpenGLView::get_parent_OpenGLView ( ) const
inline
void MGOpenGLView::get_projection_matrix ( const int  vp[4],
glm::mat4 &  projMat 
) const

get projection matrix, given the viewport data

引数
vpviewport data ={left, bottom, widht, height}
double MGOpenGLView::get_scale ( )
inline
bool MGOpenGLView::get_surface_parameter_glv ( const MGFSurface surf,
int  sx,
int  sy,
MGPosition uv 
) const

Get the surface parameter value uv(u,v) where screen coordinate (sx,sy) is projected on. If no projection points are found, the nearest point to a perimeter of surf will be returned.

引数
surfTarget surface.
sxScreen coordinates x. (left, bottom) is (0,0).
syy.
uvsurface parameter (u,v) where (sx,sy) is projected on will be returned.
void MGOpenGLView::get_viewport ( glm::ivec4 &  vp) const

get viewport of OpenGL.

引数
vp(vp[0],vp[1]) is (left,bottom) coordinates. (vp[2],vp[3]) is (width, height) of the viewport.
void MGOpenGLView::get_viewport ( int  vp[4]) const
引数
vp(vp[0],vp[1]) is (left,bottom) coordinates. (vp[2],vp[3]) is (width, height) of the viewport.
void MGOpenGLView::get_window ( int &  width,
int &  height 
) const

get window(m_width, m_height);

static MGOpenGLView* MGOpenGLView::getCurrentOpenGLView ( )
inlinestatic

Get the current active MGOpenGLView.

HDC MGOpenGLView::getHDC ( ) const
inline

Get redering context.

HGLRC MGOpenGLView::getRC ( ) const
inline

Get redering context.

mgSysGL* MGOpenGLView::getSysGLByFunctionCode ( int  fc)
inline
bool MGOpenGLView::has_display_list ( ) const

Test if this has a display list to draw.

bool MGOpenGLView::has_parent_OpenGLView ( ) const
inline
static const MGColor& MGOpenGLView::Hcolor ( )
inlinestatic
void MGOpenGLView::highlight ( const MGPickObjects pobjsP)
protected
void MGOpenGLView::home ( )
inline

Transform to the home position.

void MGOpenGLView::import_context ( const MGContext ctx)

Import MGOpenGLView data from MGContext.

引数
ctxTarget context.
void MGOpenGLView::importDrawAttribFromContext ( const MGContext ctx)

Import draw attrib data from MGContext. Draw attribs are colors(Bcolor, Gcolor, Hcolor), line approximation smoothness, pick aperture, and MGDrawParam.

引数
ctxTarget context.
void MGOpenGLView::importGridAttrib ( const MGContext ctx)

Import construction plane's grid data from a MGContext, which are 1)(u,v) grid numbers, 2)(u,v) grid spans. Colors are not imported.

void MGOpenGLView::importViewAttribFromContext ( const MGContext ctx)

Import MGContext's mgGLViewAttrib data, which are view mode, Construction Plane, and viewing transfromation data.

引数
ctxTarget context.
void MGOpenGLView::initialize_viewing_environment ( const MGPlane plane,
double  diameter,
bool  rotate = false 
)

Initialize the viewing environment to view objects projected onto a plane. The pespectiveness is unchanged. center of the object is the origin of the plane.

引数
planeTarget plane.
diameterdiameter of the view. This is set to m_diameter. diameter of the sphere that sorround the model.
rotateif true, 90 degree rotation will be performed for the plane. (-v_deriv, u_deriv) will be (x,y), If false, (u_deriv, v_deriv) will be (x,y).
void MGOpenGLView::initializeViewingEnvironmentByBox ( const MGBox box)
bool MGOpenGLView::is_enabled_grid_snap ( ) const
bool MGOpenGLView::is_perspective ( ) const
inline

Return if this is a perspective view or not.

int MGOpenGLView::line_density ( ) const
inline

Return line density for a surface to draw in wire mode.

MGPosition MGOpenGLView::locate_glv ( int  x,
int  y,
MGPosition uv = 0 
) const

locate the screen coordinate (x,y) in the 3D world coordinate. (x, y)'s origin is (left, bottom) of the screen. In uv, the construction plane's parameter(u,v) coordinate will be returned.

void MGOpenGLView::make_construction_plane ( const MGPosition mid,
const MGVector uderi,
const MGVector vderi,
double  uspan,
double  vspan,
int  ulnum,
int  lnum 
)
引数
midcenter of the construction plane.
uderiu-axis vector of the construction plane.
vderiv-axis vector of the construction plane.
uspanspan length between the lines along u-axis.
vspanspan length between the lines along v-axis.
ulnumnumber of lines to draw along u-axis.
lnumnumber of lines to draw along v-axis.
void MGOpenGLView::make_display_list ( const MGContext ctx,
const MGGroup grp 
)

Make openGL display list of a standard mgl file in the input glview. A standard mgl file means that all the objects are read into a MGGroup object, and that the objects are the target to make display list. If this is not the case, make display list as follows:

  1. Name the display list as e.g. NAME, and generate the display list by glNewName.
  2. Store all the data to display in the display list NAME. (Sometimes glCallList may be useful.) At this time, use glPushName() whose list name is int(MGObject*). MGOpenGLView's pick() will return the MGObject* when pick() is invoked.
  3. Let MGOpenGLView know the list NAME by invoking set_display_list().
void MGOpenGLView::makeRCCurrent ( ) const

Each viewport uses its own context, so we need to make sure the correct context is set whenever we make an OpenGL command.

void MGOpenGLView::mglRotate ( float  angle,
const glm::vec3 &  axis 
)
void MGOpenGLView::mglScale ( const glm::vec3 &  factor)

angle's unit is degree.

void MGOpenGLView::mglTranslate ( const glm::vec3 &  vec)

Simulate OpenGL's Translation and rotate to this ModelView. mglXXXX performs the transformation to m_modelViewMat.

void MGOpenGLView::pan_zoom ( int  x0,
int  y0,
int  x1,
int  y1 
)

Translate and scale the current view. (x0, y0) to (x1,y1) is the rectangle of screen coordinate whose origin is (left,bottom).

void MGOpenGLView::pan_zoom ( const MGBox box)

Translate and scale the current view. box is the world coordinate's box cube.

float MGOpenGLView::pick_aperture ( ) const

Get the pick aperture.

const MGEdge* MGOpenGLView::pick_edge_glv ( const MGFace f,
int  sx,
int  sy,
MGPosition uv = 0,
float  aperturex = -1.,
float  aperturey = -1. 
)

Pick an edge of the face f. That is, obtain the edge number that passes input (sx,sy) when drawn in the current view matrix. Function's return value is the edge pointer picked. When no edges are picked, null will be returned.

引数
fTarget face.
sxX of Screen coordinate. (left, bottom) is (0,0).
syY.
uvsurface parameter (u,v) nearest to (sx,sy) will be returned.
aperturexspecifies pick aperture of x and y.
apertureyWhen <=0. value is specified, default value(the value obtained by pick_aperture() will be used.
MGPickObjects MGOpenGLView::pick_glv ( const float  center[2],
float  aperturex = -1.,
float  aperturey = -1.,
const MGAbstractGels objtype = mgAll_Object 
)

Pick objects in the display list generated by make_display_list. Function's return value is MGPickObject vector. All the objects which were inside the pick aperture will be output. This data can be accessed using current_object()cy or current_PickObject(). pick will invoke makeRCCurrent();

引数
centerScreen coordinates. (left, bottom) is (0,0).
aperturexspecifies pick aperture of x and y.
apertureyWhen <=0. value is specified, default value(the value obtained by pick_aperture() will be used.
objtypeTarget object kind. See MGGEL_KIND in "mg/types.h" or "mg/default.h"
int MGOpenGLView::pick_perimeter_glv ( const MGSurface surf,
int  sx,
int  sy,
MGPosition uv = 0,
float  aperturex = -1.,
float  aperturey = -1. 
)

Pick a perimeter of the surface surf. That is, obtain the perimeter number that passes input (sx,sy) when drawn in the current view matrix. Function's return value is perimeter number picked. When no perimeters are picked, -1 will be returned.

引数
surfTarget surface.
sxX of Screen coordinate. (left, bottom) is (0,0).
syY.
uvsurface parameter (u,v) nearest to (sx,sy) will be returned.
aperturexspecifies pick aperture of x and y.
apertureyWhen <=0. value is specified, default value(the value obtained by pick_aperture() will be used.
int MGOpenGLView::pick_start_end_glv ( const MGCurve curve,
int  sx,
int  sy 
)

Determine if screen coordinate (sx,sy) is closer to the start point or to the end of the curve curve. Functin's return value is 0: if start point, 1: if end point.

引数
curveTarget curve.
sxX of Screen coordinate. (left, bottom) is (0,0).
syY.
int MGOpenGLView::pick_to_select_buf ( const float  center[2],
const float  delta[2],
mgVBO display_list,
std::set< unsigned > &  selected 
)

Function's return value is the number of hit objects.

引数
centerScreen coordinates. (left, bottom) is (0,0).
delta(aperturex, aperturey).
display_listdisplay list that includes pick objects.
selectedSelected data will be returned. This data consist of the data set by setSelectName.
void MGOpenGLView::project ( const MGPosition world,
MGPosition screen,
const glm::mat4 *  modelMat = 0,
const glm::mat4 *  projlMat = 0,
const glm::ivec4 *  vp = 0 
) const

project world coordinates to OpenGL's screen coordinates. If modelMat, projMat, or vp is not input, project will ask OpenGL to get them. Generally, users of project are recommended to get modelMat, projlMat, or vp, and input them to project. Before use of project, SetContext() must be invoked.

引数
worldTarget world coordinate.
screenScreen coordinate will be output.
modelMatOpenGL's model matrix
projlMatOpenGL's projection matrix
vpOpenGL's viewport
mgSysGL* MGOpenGLView::push_back_to_sysgl ( int  fc,
const MGGel oi = 0 
)
inline

Push back (function_code, object id) to the end or the beginning of system display list. Function's return value is the mgSysGL pointer pushed. sysgl can be handled(can be erased after the generation) by (1)function code fc (2)object id oi(in other words, object name). If the system display list is to handle by the id(object name), oi must be meaningful. Usually oi is recommended to be the object pointer. If display list handling is not intended by the object id, set oi as null. int push_back_to_sysgl(int fc, MGGel* oi=0){return m_sysgllist.push_back(fc,oi);}; int push_front_to_sysgl(int fc, MGGel* oi=0){return m_sysgllist.push_front(fc,oi);};

void MGOpenGLView::push_back_to_sysgl ( mgSysGL sysgl)
inline

Push back (function_code, object id) to the end or the beginning of system display list. sysgl must be a newed object, and the ownership will be transfered to this.

mgSysGL* MGOpenGLView::push_front_to_sysgl ( int  fc,
const MGGel oi = 0 
)
inline
void MGOpenGLView::rotate ( float  angle,
float  x,
float  y,
float  z 
)

Rotate the current view by the angle along the vector(x,y,z), performs a counterclockwise rotation of angle about the vector from the m_center. The rotation matrix made is stored in m_PreCenterMat.

void MGOpenGLView::rotate ( float  angle,
float  vector[3],
const MGPosition center 
)

Rotate the current view by the angle along vector around center. Performs a counterclockwise rotation. The rotation matrix made is stored in m_PreCenterMat.

void MGOpenGLView::rotate ( const float  angle[2])

Rotate the current view by the angle[0] around m_up_vector_current(Y-direction of the screen), and by the angle[1] around m_XAxis_current(view-up-vector*eye-vector=X-direction of the screen). Rotation is performed around m_center_current. (m_center_current,m_up_vector_current,m_XAxis_current) are et by set_center_current. The rotation matrix made is stored in m_PreCenterMat.

void MGOpenGLView::scale ( double  factor,
int *  center = 0 
)

Scale the current view by the factor and the view center.

引数
factorsaling factor.
centerscaling center of the screen coordinate (sx, sy) on the view plane, where sx=center[0], sy=center[1] if center!=0.
void MGOpenGLView::screen_to_world ( int  wh[2],
double  sx,
double  sy,
double &  wx,
double &  wy 
) const

Convert the screen coordinate (sx, sy) to world coordinate (wx, wy) on the view plane.

引数
whwidth(wh[0]) and height(wh[1]) of the screen.
sxInput screen x.
syy
wxWorld x will be output.
wyy will be output.
void MGOpenGLView::set_center ( const MGPosition pos)
inline
void MGOpenGLView::set_center_current ( int  x,
int  y 
)
void MGOpenGLView::set_display_list ( mgVBO dlist)
inline

Update display list name that shows all of the objects in this view.

引数
dlistThe target graphic object.
void MGOpenGLView::set_fovy ( double  fovy)
inline
void MGOpenGLView::set_line_density ( int  line_density = 1)

Set line density for a surface to draw in wire mode.

void MGOpenGLView::set_output_dpi ( float  dpi)
inline
void MGOpenGLView::set_parent_OpenGLView ( MGOpenGLView parent = 0)

Set the parent MGOpenGLView.

void MGOpenGLView::set_perspective ( bool  pers,
double  fovy = 45. 
)
inlineprotected

Set if this view is a perspective view(true), or orthnormal view(false).

void MGOpenGLView::set_pick_aperture ( double  pick_aperture)
void MGOpenGLView::set_pick_aperture ( float  pick_aperture)
void MGOpenGLView::set_smooth ( float  smooth)

set the smooth factor of this view.

void MGOpenGLView::set_window ( int  width,
int  height 
)

Set the window as(0,0)-(width,height). This invokes glViewport().

void MGOpenGLView::setBcolor ( const MGColor color)

Set background color;.

void MGOpenGLView::setDCRC ( HDC  dc,
HGLRC  rc 
)

Set redering context.

void MGOpenGLView::setDpiFactor2GLSL ( )
void MGOpenGLView::setDrawParam ( const MGContext ctx)
void MGOpenGLView::setEyePositionUpVector ( const MGPosition eyeP,
const MGVector upVector 
)

Set m_eyeP and m_up_vector(the eye position and view-up-vector of the OpenGL).

void MGOpenGLView::setGcolor ( const MGColor color)

Set default object color;.

static void MGOpenGLView::setHcolor ( const MGColor color)
inlinestatic

Set hilight color;.

void MGOpenGLView::setModelViewMat2GLSL ( )

Set Model_View matrix of OpenGL(setUniform).

void MGOpenGLView::setNdcMat2GLSL ( )

Set ndc factors.

void MGOpenGLView::setProjectionMat2GLSL ( bool  initialize = false)

Set Projection matrix to GLSL. initialize==true means the projection matrix will be replaced by the projection matrix defined by the current viewport and the model data.

void MGOpenGLView::setProjModelViewMat2GLSL ( )

Set ProjModelView matrix to GLSL using setUniform();.

void MGOpenGLView::setupDrawEnv ( const MGColor backColor,
bool  selection = false 
)

Set up drawing environment.

void MGOpenGLView::setViewMode ( MGCL::VIEWMODE  vmode = MGCL::WIRE)

Set view mode.

float MGOpenGLView::smooth ( ) const

Get the smooth factor of this view.

double MGOpenGLView::span_length ( ) const
inline

Get the draw span length(approximate line segment length to draw curves).

void MGOpenGLView::translate ( double  dx,
double  dy 
)

Translate the current view by (dx, dy).

void MGOpenGLView::translate_without_scale ( double  dx,
double  dy 
)

Translate the current view by (dx, dy) without current scale.

void MGOpenGLView::unproject ( int  x,
int  y,
MGStraight sl,
MGCSisect is 
) const

Convert the windows screen coordinate (x,y) to MGCL's straight line. and get the intersection of the straight line and the construction plane. The origin of the screen coordinate is left, bottom. Not left, top. The direction of the sl is from the screen to the viewer.

引数
xX screen coordinate whose origin is (left, bottom).
yY.
slThe straight line of (x,y) will be returnred.
isthe intersectio of the sl and the construction plane will be returned.
void MGOpenGLView::unproject_to_sl_glv ( int  x,
int  y,
MGStraight sl 
) const

Convert the windows screen coordinate (x,y) to MGCL's straight line. The origin of the screen coordinate is left, bottom. Not left, top. The direction of the sl is from the screen to the viewer.

const MGVector& MGOpenGLView::view_up_vector ( ) const
inline

Get the view up vector.

double MGOpenGLView::view_volume_far ( ) const
inline

compute the view volume far.

double MGOpenGLView::view_volume_height ( ) const
inline

compute the view volume height.

double MGOpenGLView::view_volume_near ( ) const
inline

compute the view volume near.

const MGglViewAttrib& MGOpenGLView::viewAttrib ( ) const
inline
MGglViewAttrib& MGOpenGLView::viewAttrib ( )
inline
MGCL::VIEWMODE MGOpenGLView::viewMode ( ) const
inline

メンバ詳解

MGColor MGOpenGLView::m_Bcolor
protected

Background color.

glm::vec3 MGOpenGLView::m_center_current
protected

Current center after transformations(a point on m_unprojectSL_current).

mgVBO* MGOpenGLView::m_display_list
protected

Display list name of the document which is displayed on this glview. m_display_list=0 indicates no display list is generated for this glview.

float MGOpenGLView::m_dpi
protected

Projection matrix to set into uniform.

MGColor MGOpenGLView::m_Gcolor
protected

Object lines color.

HDC MGOpenGLView::m_hDC
protected

Device Context.

int MGOpenGLView::m_height
protected
HGLRC MGOpenGLView::m_hRC
protected

Rendering context.

  1. Static atributes(usually not changed after this is initaialized)
glm::mat4 MGOpenGLView::m_lookAtMat
protected

and view_up_vector().

glm::lookAt matrix constructied from eye_position()

MGOpenGLView* MGOpenGLView::m_parent_glView
protected

0.

If this OpenGLView has the parent, the pointer will be set. The parent means all of the display list are shared with the parent's, and on this drawScene's invocation, the parent's display list will be drawn.

float MGOpenGLView::m_pick_aperture
protected

Pick aperture. Number of pixels to allow picking.

glm::mat4 MGOpenGLView::m_projMat
protected
float MGOpenGLView::m_smooth
protected

Smoothness of the curves to draw. 1/smooth is the division number of a curve whose length is the window width. When smooth becomes small, smoothness increases.

mgSysGLList MGOpenGLView::m_sysgllist

System display list manager.

glm::vec3 MGOpenGLView::m_up_vector_current
protected
MGglViewAttrib MGOpenGLView::m_viewAttrib
protected

Attributes that are saved to .mgl file.

int MGOpenGLView::m_width
protected

アトリビュート

glm::vec3 MGOpenGLView::m_XAxis_current
protected

the current unprojected straight line of the input cursor is set.

  1. Dynamic atributes(depend on what is current viewing environment). When set_center_current is invoked,

このクラス詳解は次のファイルから抽出されました: