2 # pragma warning (disable: 4005) // for VS8 + WX
5 #include "OpenGLCanvas.hh"
7 #include <Base/Image/ImageIO.hh>
8 #include <Base/Math/Vector2.hh>
9 #include <Base/Math/Vector3.hh>
10 #include <Base/Math/Vector4.hh>
12 #include "GeometryGL.hh"
31 #if OPENGLCANVAS_CONNECT_ONIDLE
32 EVT_IDLE (OpenGLCanvas::OnIdle)
41 bool
OpenGLCanvas::idleRepaintEnabled = OPENGLCANVAS_DEFAULT_idleRepaintEnabled;
42 bool OpenGLCanvas::realtimeAnimation = OPENGLCANVAS_DEFAULT_realtimeAnimation;
47 delete p_viewCtrl_; p_viewCtrl_=NULL;
52 OpenGLCanvas::OpenGLCanvas(
60 ,
const wxPalette& palette
72 ,wxGLContext* sharedContext
79 ,
const wxPalette& palette
81 :
OpenGLCanvasBase(parent,sharedContext,id,pos,size,style,name,attribList,palette)
140 wxPoint pos=
event.GetPosition();
141 if ((event.LeftIsDown() &&
event.RightIsDown()) || event.MiddleIsDown()){
143 }
else if (event.LeftIsDown()){
145 }
else if (event.RightIsDown()){
157 wxPoint pos=
event.GetPosition();
166 const double fraction=0.25;
167 const int rot =
event.GetWheelRotation();
175 BIASWARN(
"invalid wheel motion rot="<<rot);
217 time +=1.0/TARGET_FPS;
virtual void Display()
display call to be overridden by child classes
static bool realtimeAnimation
virtual void DisplayCameraViewExternalParams()
virtual void GetInfoGL(std::ostream &os)
return GL state information
void MotionTranslationCoplanar(const BIAS::Vector2< double > &pos)
static bool animationUpdateEnabled
virtual void DisplayCameraViewInternalParams()
virtual void InitMembers()
any constructor should call this function to initialize all data members (e.g.
virtual void InitMembers()
any constructor should call this function to initialize all data members (e.g.
std::ostream & Print(std::ostream &os=std::cout)
map update of one axis (mouse wheel, delta, key...) maps delta (e.g.
virtual void DisplayGLInternal()
OpenGL canvases with additinal event handling (JW)
void OnIdle(wxIdleEvent &event)
virtual void UpdateTime()
sets the internal time param, by default based on realtime wall clock
CameraViewFrustum frustum
base for (interactively) manipulating a (virtual) camera view.
void ShowFPS()
simple interface for the above
virtual void GetInfoGL(std::ostream &os=std::cout)
return GL state info
unsigned int GetHeight() const
OpenGLCanvas(wxFrame *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=AsciiToWx("OpenGLCanvas"), int *attribList=NULL, const wxPalette &palette=wxNullPalette)
constructors:
void MoveToCenter(const double &fraction)
void SetStartPos(const BIAS::Vector2< double > &pos)
toplevel entry for all motion controllers
base class for OpenGL canvases you could derive from to get base functionality (JW) ...
void OnMouseWheel(wxMouseEvent &event)
CameraViewInternals GetInternals() const
unsigned int GetWidth() const
float GetAspectRatio() const
GetAspectRatio is X/Y.
void SetSize(const BIAS::Vector2< double > &sz)
interaction area size
void OnMouseDown(wxMouseEvent &event)
void MotionTranslationForward(const BIAS::Vector2< double > &pos)
virtual void DisplayGLExternal()
void ShowValue(const wxPoint &pos)
void MotionTranslation(const BIAS::Vector2< double > &pos)
simple translation
CameraViewController * p_viewCtrl_
virtual void DisplayCameraView()
virtual void Reshape()
change of size and aspect ratio.
void OnMotion(wxMouseEvent &event)
void AdaptWidth(const double &vpAspectRatioDesired)
adapt left and right to match an aspect ratio useful to adapth frustum to viewport bound to windows s...
virtual void UpdateTime()
sets the internal time param, by default based on realtime wall clock
CameraViewController GetViewController() const
static bool idleRepaintEnabled
virtual void Display()
main display call to be overridden by child classes usually displays: -InitWithContext (must be done ...