77范文网 - 专业文章范例文档资料分享平台

研究生计算机图形学课程室内场景OpenGL--实验报告(3)

来源:网络收集 时间:2019-04-09 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

void CMainFrame::Dump(CDumpContext& dc) const { CFrameWnd::Dump(dc); }

#endif //_DEBUG

// CMainFrame message handlers void CMainFrame::OnPaint() { CPaintDC dc(this); // device context for painting }

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { if (!m_wndSplitter.CreateStatic(this, 1, 2,WS_CHILD | WS_VISIBLE)) { TRACE(\ return FALSE; } // First splitter pane if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CRenderView), CSize(600,500), pContext)) { TRACE(\ return FALSE; } if (!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CFormCommandView), CSize(0,0), pContext)) { TRACE(\ return FALSE; } // Second splitter pane return TRUE; }

4、RenderView.cpp

11

#include \#include \#include #include #include

#include \#include \

#ifdef _DEBUG

#define new DEBUG_NEW #undef THIS_FILE

static char THIS_FILE[] = __FILE__; #endif

extern void Render(void);

// This is the holding space for the landscape colours.

int WinWidth, WinHeigth;

unsigned short int comp = 32; // Scale modifier.

unsigned short int temp, texture_mapping = FALSE,

land_fogging = TRUE, flat_shading = TRUE;

float angle, Near, ex, ey, ez, cx, cy, cz;

// Initial eye position and vector of sight. static GLfloat speed = 0;

// The following code for mouse routines was contributed. // These are used for the motion function. #define FORWARD 1 #define UP 2

#define TURNLEFT 3 #define LOOKUP 5

// Mouse position and button.

12

int oldmx = 0, oldmy = 0, mb;

// CRenderView

IMPLEMENT_DYNCREATE(CRenderView, CView)

BEGIN_MESSAGE_MAP(CRenderView, CView) //{{AFX_MSG_MAP(CRenderView) ON_WM_DESTROY() ON_WM_SIZE()

ON_WM_LBUTTONDOWN() ON_WM_LBUTTONUP() ON_WM_MOUSEMOVE() ON_WM_PAINT() ON_WM_CREATE() //}}AFX_MSG_MAP // Standard printing commands

ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)

ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)

ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) END_MESSAGE_MAP()

// CRenderView construction/destruction

CRenderView::CRenderView() {

// OpenGL

m_hGLContext = NULL; m_GLPixelIndex = 0;

// Mouse

m_LeftButtonDown = FALSE; m_RightButtonDown = FALSE;

m_CursorRotation = AfxGetApp()->LoadCursor(IDC_CURSOR_ROTATION);

// Colors

CToolApp *pApp = (CToolApp *)AfxGetApp();

m_ClearColorRed = GetRValue(pApp->m_OptionColorGlBack); m_ClearColorGreen = GetGValue(pApp->m_OptionColorGlBack); m_ClearColorBlue = GetBValue(pApp->m_OptionColorGlBack);

13

ReadData();

WinWidth=1000; WinHeigth=800; LoadAllTexture(); InitLookAt(); }

//============================================ // InitGeometry

//============================================ void CRenderView::InitGeometry(void) {

GLfloat fogColor[4] = {0.75, 0.75, 1.0, 1.0};

speed = 0;

srand(224);

srand((unsigned)time(NULL));

glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glEnable(GL_DEPTH_TEST); glShadeModel(GL_FLAT);

glFogi(GL_FOG_MODE, GL_LINEAR); glFogfv(GL_FOG_COLOR, fogColor); glFogf(GL_FOG_DENSITY, 0.8f); glFogf(GL_FOG_START, 400.0f); glFogf(GL_FOG_END, 500.0f); glClearColor(0.75f, 0.75f, 1.0f, 1.0f); }

CRenderView::~CRenderView() { FreeAllTexture(); freelist(); }

BOOL CRenderView::PreCreateWindow(CREATESTRUCT& cs) {

return CView::PreCreateWindow(cs);

14

}

// CRenderView drawing

void CRenderView::OnDraw(CDC* pDC) { }

BOOL CRenderView::OnPreparePrinting(CPrintInfo* pInfo) {

return DoPreparePrinting(pInfo); }

void CRenderView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { }

void CRenderView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { }

// CRenderView diagnostics #ifdef _DEBUG

void CRenderView::AssertValid() const {

CView::AssertValid(); }

void CRenderView::Dump(CDumpContext& dc) const {

CView::Dump(dc); }

CToolDoc* CRenderView::GetDocument() // non-debug version is inline {

if (m_pDocument){

ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CToolDoc))); return (CToolDoc*)m_pDocument; }

else return NULL;

15

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库研究生计算机图形学课程室内场景OpenGL--实验报告(3)在线全文阅读。

研究生计算机图形学课程室内场景OpenGL--实验报告(3).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/581201.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: