opengl在MFC平台上绘制三维图形并实现旋转移动缩放


在MFC平台上上利用OPENGL实现三维立体图形的绘制,进行了光照和材料等的渲染,并且利用键盘控制物体的旋转、移动、缩放!程序已经过调试,可直接使用!
资源截图
代码片段和文件信息
// MainFrm.cpp : CMainframe 类的实现
//

#include “stdafx.h“
#include “mfc_cylinder.h“

#include “MainFrm.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CMainframe

IMPLEMENT_DYNCREATE(CMainframe CframeWnd)

BEGIN_MESSAGE_MAP(CMainframe CframeWnd)
ON_WM_CREATE()
END_MESSAGE_MAP()

static UINT indicators[] =
{
ID_SEPARATOR           // 状态行指示器
ID_INDICATOR_CAPS
ID_INDICATOR_NUM
ID_INDICATOR_SCRL
};


// CMainframe 构造/析构

CMainframe::CMainframe()
{
// TODO: 在此添加成员初始化代码
}

CMainframe::~CMainframe()
{
}


int CMainframe::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CframeWnd::OnCreate(lpCreateStruct) == -1)
return -1;

if (!m_wndToolBar.CreateEx(this TBstyle_FLAT WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINframe))
{
TRACE0(“未能创建工具栏
“);
return -1;      // 未能创建
}

if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators
  sizeof(indicators)/sizeof(UINT)))
{
TRACE0(“未能创建状态栏
“);
return -1;      // 未能创建
}

// TODO: 如果不需要可停靠工具栏,则删除这三行
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);

return 0;
}

BOOL CMainframe::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CframeWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: 在此处通过修改
//  CREATESTRUCT cs 来修改窗口类或样式

return TRUE;
}


// CMainframe 诊断

#ifdef _DEBUG
void CMainframe::AssertValid() const
{
CframeWnd::AssertValid();
}

void CMainframe::Dump(CDumpContext& dc) const
{
CframeWnd::Dump(dc);
}

#endif //_DEBUG


// CMainframe 消息处理程序




 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     144896  2011-10-17 19:03  MFC下的可动光照圆柱mfc_cylinderDebugmfc_cylinder.exe

     文件    2248808  2011-10-17 19:03  MFC下的可动光照圆柱mfc_cylinderDebugmfc_cylinder.ilk

     文件    3755008  2011-10-17 19:03  MFC下的可动光照圆柱mfc_cylinderDebugmfc_cylinder.pdb

     文件       7362  2011-10-17 19:03  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugBuildLog.htm

     文件      34575  2011-10-17 11:10  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugMainFrm.obj

     文件        920  2011-10-17 11:10  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugmfc_cylinder.exe.embed.manifest

     文件        984  2011-10-17 11:10  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugmfc_cylinder.exe.embed.manifest.res

     文件        861  2011-10-17 19:03  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugmfc_cylinder.exe.intermediate.manifest

     文件      37262  2011-10-17 16:28  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugmfc_cylinder.obj

     文件   25296896  2011-10-17 11:10  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugmfc_cylinder.pch

     文件      28300  2011-10-17 11:10  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugmfc_cylinder.res

     文件      21934  2011-10-17 11:10  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugmfc_cylinderDoc.obj

     文件      61215  2011-10-17 19:03  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugmfc_cylinderView.obj

     文件         67  2011-10-17 19:03  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugmt.dep

     文件     465891  2011-10-17 11:10  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugstdafx.obj

     文件     928768  2011-10-17 19:03  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugvc90.idb

     文件    2011136  2011-10-17 19:03  MFC下的可动光照圆柱mfc_cylindermfc_cylinderDebugvc90.pdb

     文件       1802  2011-10-17 08:49  MFC下的可动光照圆柱mfc_cylindermfc_cylinderMainFrm.cpp

     文件        655  2011-10-17 08:49  MFC下的可动光照圆柱mfc_cylindermfc_cylinderMainFrm.h

     文件      51408  2011-10-17 10:14  MFC下的可动光照圆柱mfc_cylindermfc_cylindermfc_cylinder.aps

     文件       3353  2011-10-17 08:49  MFC下的可动光照圆柱mfc_cylindermfc_cylindermfc_cylinder.cpp

     文件        508  2011-10-17 08:49  MFC下的可动光照圆柱mfc_cylindermfc_cylindermfc_cylinder.h

     文件      10360  2011-10-17 08:49  MFC下的可动光照圆柱mfc_cylindermfc_cylindermfc_cylinder.rc

     文件       5911  2011-10-17 09:31  MFC下的可动光照圆柱mfc_cylindermfc_cylindermfc_cylinder.vcproj

     文件       1427  2011-10-17 19:13  MFC下的可动光照圆柱mfc_cylindermfc_cylindermfc_cylinder.vcproj.PC-201108260937.吴梅君.user

     文件       1128  2011-10-17 08:49  MFC下的可动光照圆柱mfc_cylindermfc_cylindermfc_cylinderDoc.cpp

     文件        582  2011-10-17 08:49  MFC下的可动光照圆柱mfc_cylindermfc_cylindermfc_cylinderDoc.h

     文件       9316  2011-10-17 19:13  MFC下的可动光照圆柱mfc_cylindermfc_cylindermfc_cylinderView.cpp

     文件       1815  2011-10-17 16:28  MFC下的可动光照圆柱mfc_cylindermfc_cylindermfc_cylinderView.h

     文件       3550  2011-10-17 08:49  MFC下的可动光照圆柱mfc_cylindermfc_cylinderReadMe.txt

............此处省略20个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)