⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gl2view.h

📁 该文件是教你如何来保存窗口的图形,以及如何截取图形.
💻 H
字号:
// gl2View.h : interface of the CGl2View class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_GL2VIEW_H__875AFAA4_071C_44AE_BE59_67C04705DD53__INCLUDED_)
#define AFX_GL2VIEW_H__875AFAA4_071C_44AE_BE59_67C04705DD53__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "gl\gl.h"
#include "gl\glu.h"
#include "Hdibapi.h"
  class CGl2View : public CView
{
protected: // create from serialization only
	CGl2View();
	DECLARE_DYNCREATE(CGl2View)

// Attributes
public:
	CGl2Doc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CGl2View)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CGl2View();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CGl2View)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnPlayPause();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnFileSavetobmpClientbmp();
	afx_msg void OnFileSavetobmpRectanglebmp();
	afx_msg void OnFileSavetobmpWindowsbmp();
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

public:
	void FreeDIB();
	void GetDIB();
	void SaveToBMP();
public:
    CPoint MouseDownPoint;
	RECT		 m_Rect;
	BOOL		 m_bSaveRectBMP;
    POINT        c_down;
    POINT        c_last;
    POINT 	     Zoom_in_First;
	POINT 	     Zoom_in_Last;
   int displayfashion,mutumodel;
   	double X_Angle;//旋转角度
	double Y_Angle;//旋转角度
	double Z_Angle;//旋转角度
	double X_Trans;//X平移距离
	double Y_Trans;//Y平移距离



    HDIB         hDIB;
   // RECT		 m_Rect;
    //BOOL		 m_bSaveRectBMP;
	enum         CSaveBMPFlag { BMPRECT = 0, BMPWINDOW, BMPCLIENT };
	CSaveBMPFlag m_nSaveBMPFlag;
public:
	CPalette m_cPalette;
	CPalette *m_pOldPalette;
	 CClientDC *m_pDC;
	 CRect m_oldRect;
public:

	void GLTextOut(GLuint id,const char * const textstring);
	unsigned char ComponentFromIndex(int i,UINT nbits,UINT shift);
	void  CreateRGBPalette();
protected:
	GLfloat m_lightAmb[4];
	GLfloat m_lightDif[4];
	GLfloat m_lightSpe[4];
	GLfloat m_lightPos[4];
	
	GLfloat   m_fAngleX;
	GLfloat   m_fAngleY;
	GLfloat   m_fAngleZ;
	BOOL      m_play;
	
	 

protected:
    	void CalculateNormal(GLdouble* dVertex1,GLdouble* dVertex2,GLdouble* dVertex3,GLdouble* dNormal);
	void DrawCube();
	void Init();
	BOOL bSetupPixelFormat();
	void DrawScene();
	void CreatLights();
};

#ifndef _DEBUG  // debug version in gl2View.cpp
inline CGl2Doc* CGl2View::GetDocument()
   { return (CGl2Doc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_GL2VIEW_H__875AFAA4_071C_44AE_BE59_67C04705DD53__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -