文件名称:OpenG框架实现
文件大小:124KB
文件格式:EXE
更新时间:2016-01-13 04:10:05
框架实现
void C09990156View::OnDraw(CDC* pDC) { CTest3Doc* pDoc = GetDocument(); ASSERT_VALID(pDoc); CPaintDC DC(this); glLoadIdentity(); glClearColor(1.0f,1.0f,1.0f,1.0f); //把红、绿、蓝分量分别指定为1、0、0 glClear(GL_COLOR_BUFFER_BIT); if (m_bLine) { glBegin(GL_LINES); glColor3f(m_r,m_g,m_b); //直线的R、G、B颜色值调用 glVertex2f(m_Lx1,m_Ly1); glVertex2f(m_Lx2,m_Ly2); glEnd(); } if (m_bPoint) { glBegin(GL_POINTS); glColor3f(m_r,m_g,m_b); //点的R、G、B颜色值调用 glVertex2f(m_PtX,m_PtY); glEnd(); } glFlush(); SwapBuffers(DC.m_hDC); HDC hdc=wglGetCurrentDC(); ::SetBkMode(hdc,TRANSPARENT); ::SetTextColor(hdc,RGB(250,0,0)); ::TextOutA(hdc,0,0,"计算机图形学示例程序",20); ::TextOutA(hdc,0,20,"09990156黄慧勤",14); ::TextOutA(hdc,0,40,"2012年10月",10); }