00001 #include "vuFBRSubCanvas.h"
00002 #include <GL/gl.h>
00003 #include <GL/glu.h>
00004 #include "vuSimpleFVRDialog.h"
00005
00006
00007 template <int S, class T>
00008 vuFBRSubCanvas<S,T>::vuFBRSubCanvas(vuBasicSubViewer *parent,wxWindowID id)
00009 : vuBasicSubViewerCanvas(parent,id)
00010 {
00011 m_Image = NULL;
00012 m_ImageRGB = NULL;
00013 m_ImageScale = 255.0f;
00014
00015 m_RenderMethod = 0;
00016
00017 m_Image = new vuFixelMap1F(200,200);
00018
00019 m_Interactive = NULL;
00020 }
00021
00022
00023 template <int S, class T>
00024 vuFBRSubCanvas<S,T>::~vuFBRSubCanvas()
00025 {
00026 CHECKNDELETE(m_Image);
00027 CHECKNDELETE(m_ImageRGB);
00028
00029 }
00030
00031 template <int S, class T>
00032 void vuFBRSubCanvas<S,T>::setRenderMethod(dword method)
00033 {
00034 m_RenderMethod = method;
00035 if (m_RenderMethod > 9) m_RenderMethod = 0;
00036 }
00037
00038 template <int S, class T>
00039 void vuFBRSubCanvas<S,T>::setImageScale(float scale)
00040 {
00041 m_ImageScale = scale;
00042 }
00043
00044 template <int S, class T>
00045 void vuFBRSubCanvas<S,T>::setInteractive(vuSphericInteractive<S,T> *ia)
00046 {
00047 m_Interactive = ia;
00048 }
00049
00050
00051
00052
00053
00054 template <int S, class T>
00055 bool vuFBRSubCanvas<S,T>::glInit(void)
00056 {
00057 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
00058 return true;
00059 };
00060
00061
00062
00063
00064
00065 template <int S, class T>
00066 void vuFBRSubCanvas<S,T>::resize()
00067 {
00068 if (m_Interactive) {
00069 vuSphericView<S,T> *view = m_Interactive->nearestView();
00070 if (view) view->glResize(getWidth(), getHeight());
00071 }
00072 }
00073
00074
00075
00076
00077
00078 template <int S, class T>
00079 void vuFBRSubCanvas<S,T>::render()
00080 {
00081 if (m_Interactive) {
00082 vuSphericView<S,T> *view = m_Interactive->nearestView();
00083 if (view) view->glRender();
00084 }
00085 }
00086
00087
00088
00089
00090
00091
00092 template <int S, class T>
00093 void vuFBRSubCanvas<S,T>::postEvent(wxEventType ev)
00094 {
00095 wxCommandEvent commandEvent(ev, GetId());
00096 commandEvent.SetEventObject(this);
00097
00098 GetEventHandler()->ProcessEvent(commandEvent);
00099 }