00001
00007 #pragma once
00008
00009 #include <afxwin.h>
00010 #include <sstream>
00011 #include <istream>
00012
00013 #include <GL/glew.h>
00014 #include <GL/gl.h>
00015 #include <GL/glu.h>
00016
00017 #include <vmmlib/vmmlib.hpp>
00018
00019 #include "Transferfunction.hpp"
00020 #include "FlowData.hpp"
00021
00022 #include "Tools/CGShaderManager.hpp"
00023
00025
00028 class COpenGLControl : public CWnd
00029 {
00030 friend class CVisFlowRendererDlg;
00031 private:
00032
00033
00034
00035
00036 CWnd *hWnd;
00037 HDC hdc;
00038 HGLRC hrc;
00039 int m_nPixelFormat;
00040 CRect m_rect;
00041
00042 float zoom;
00043 float scale;
00044
00045 vmml::vec2f lastpoint;
00046 vmml::vec3f campos;
00047 vmml::vec3f camrot;
00048
00049 bool enable_axes;
00050 GLuint axes;
00051 bool enable_wireframe;
00052 GLuint grid;
00053
00054 GLuint *layertransfer;
00055 GLuint *flowtextures;
00056 GLuint transfertexture;
00057 GLuint pointgrid;
00058 GLuint vectexture;
00059 GLuint *vectortexture;
00060 unsigned selected_frame;
00061
00062 bool enable_data;
00063 bool enable_glyphs;
00064
00065 unsigned selected_layer;
00066 std::vector<GLuint*> datalayers;
00067 std::vector<GLuint*> transferlayers;
00068
00069 FlowData *flowdata;
00070 protected:
00073 void checkOpenGLCapabilities();
00074
00075 void setupView();
00076 void setCamera();
00077
00078 void compileAxes();
00079 void compileGrid();
00080 void compilePointGrid(const unsigned &x=0, const unsigned &y=0);
00081
00082 void createFlowTextures();
00083 void deleteFlowTextures();
00084
00085 void createDataTextures();
00086 void deleteDataTextures();
00087
00088 void createVectorTextures(const unsigned &x=0, const unsigned &y=0);
00089 void deleteVectorTextures();
00090
00091 void DrawAxe();
00092 void DrawWireframe();
00093 void DrawFlow();
00094 void DrawData();
00095
00096 void DrawPointSprites();
00097
00098 void renderVectorTexture(GLuint &texture,const unsigned &x=0, const unsigned &y=0);
00099
00100 Tool::CGProgram transfer_fragment;
00101 Tool::CGProgram glyph_vertex;
00102 Tool::CGProgram glyph_fragment;
00103 CGparameter modelViewMatrix;
00104 public:
00105
00106 UINT_PTR m_unpTimer;
00107 bool firstsize;
00108
00109 COpenGLControl();
00110
00113 void oglCreate(CRect rect, CWnd *parent);
00114
00117 void oglInitialize(void);
00118 void setFlowData(FlowData *data);
00119
00120 void resetCamera();
00121
00122 void loadTransferTexture(Transferfunction *transfer);
00123
00124 void enableAxes(const bool &enable);
00125 const bool &enabledAxes() const;
00126
00127 void setScale(const float &scale);
00128 const float &getScale() const;
00129
00130 void setSelectedFrame(const unsigned &frame);
00131 const unsigned &getSelectedFrame() const;
00132
00133 void enableWireframe(const bool &enable);
00134 const bool &enabledWireframe() const;
00135
00136 void enableDatalayer(const bool &enable);
00137 const bool &enabledDatalayer() const;
00138 void selectDataLayer(const unsigned &index);
00139 const unsigned &getSelectedDataLayer() const;
00140
00141 void enableGlyphs(const bool &enable);
00142 const bool &enabledGlyphs() const;
00143
00144 DECLARE_MESSAGE_MAP()
00145 afx_msg void OnPaint();
00146 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00147 afx_msg void OnSize(UINT nType, int cx, int cy);
00148 afx_msg void OnDraw(CDC *pDC);
00149 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00150 afx_msg void OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt);
00151 };