OpenGLView.cpp
Upload User: kairuinn
Upload Date: 2009-02-07
Package Size: 2922k
Code Size: 60k
Category:

Graph program

Development Platform:

Visual C++

  1. // OpenGLView.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "..//Solidgraph.h"
  5. #include "OpenGLView.h"
  6. #include "..//Drawer.h"
  7. #include "..//ChildFrm.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. static GLfloat g_fMouseZMult   = 0.01f; // Mouse 'Z'-Axis multiplier
  14. static GLfloat g_fMouseRotateMult = 0.5f; // Mouse 'Rotation' multiplier 
  15. static GLfloat g_fMouseScaleMult  = 0.01f; // Mouse 'Scale' multiplier
  16. #define SEL_BUF_SIZE 65535
  17. static GLuint  hits_buffer[SEL_BUF_SIZE];
  18. /////////////////////////////////////////////////////////////////////////////
  19. // COpenGLView
  20. IMPLEMENT_DYNCREATE(COpenGLView, CView)
  21. COpenGLView::COpenGLView()
  22. {
  23. // OpenGL
  24. m_hGLContext = NULL;
  25. m_hDC = NULL;
  26. m_need_release_DC = false;
  27. m_background = NULL;
  28. // Colors
  29. m_ClearColorRed   = 1.0f;//0.7f;//191
  30. m_ClearColorGreen = 1.0f;//0.7f;//191
  31. m_ClearColorBlue  = 1.0f;//0.7f;//191
  32. m_rezPointColorRed   = 1.0f;
  33. m_rezPointColorGreen = 0.0f;
  34. m_rezPointColorBlue  = 0.0f;
  35. m_rezLineColorRed   = 0.0f;
  36. m_rezLineColorGreen = 1.0f;
  37. m_rezLineColorBlue  = 0.0f;
  38. m_rezPointSize = 5.0f;
  39. m_rezLineWidth = 2.0f;
  40. m_ScreenLeftButtonDownPoint.x = 0;
  41. m_ScreenLeftButtonDownPoint.y = 0;
  42. m_hand_action = HA_ROTATE;
  43. m_planes = new CPlanes();
  44. m_transforming_matrix = NULL;
  45. #ifdef _DEBUG
  46. m_FPSCounter.SetAveraging(FPS_TIME, 1.0); // 篑疱漤