#pragma once #pragma comment(lib, "Opengl32.lib") #pragma comment(lib, "Glu32.lib") #pragma comment(lib, "glut32.lib") #include #include #include "glut.h" // COpenGLView view enum _Mouse { BUTTON_UP = 0, LBUTTON_DOWN, RBUTTON_DOWN}; class COpenGLView : public CView { DECLARE_DYNCREATE(COpenGLView) private: int m_PixelFormat; HGLRC m_hRC; // Rendering Context CDC* m_pDC; // Device Context HFONT font; int _mouse; CPoint _mouseDownPoint; double _eyeDist; double _angleHor; double _angleVer; CPoint3d _eyePos; private: BOOL InitializeOpenGL(); protected: virtual BOOL SetupPixelFormat(); virtual BOOL RenderScene(); void RenderCoordinate(); void RenderGridmap(int GridmapSize, int StepSize); protected: COpenGLView(); // protected constructor used by dynamic creation virtual ~COpenGLView(); public: virtual void OnDraw(CDC* pDC); // overridden to draw this view #ifdef _DEBUG virtual void AssertValid() const; #ifndef _WIN32_WCE virtual void Dump(CDumpContext& dc) const; #endif #endif protected: DECLARE_MESSAGE_MAP() virtual BOOL PreCreateWindow(CREATESTRUCT& cs); public: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnDestroy(); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); };