|
|

楼主 |
发表于 2006-4-20 09:03:00
|
显示全部楼层
Re:玻璃效果的麻烦
这是渲染的部分代码
//////////////////////////////////////////////////////////
//场景绘制与渲染
//////////////////////////////////////////////////////////
BOOL CMySDOpenGL2View::RenderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //清除颜色缓存和深度缓存
// glClearColor(0.4,0.4,0.6,0.25);
glLoadIdentity();
//set the view port
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
// 初始化名字堆栈
glInitNames();
glPushName(0);
//////////////////////////////////////////////////////////////
//绘制仪器
//////////////////////////////////////////////////////////////
glPushMatrix();
glColor3f(1.0,1.0,1.0);
glTranslatef(0.0,-0.5,-5.0);
glTranslatef(0.0,0.0,size);
glRotatef(step,0.0,1.0,0.0);
OnDrawEquip();
glPopMatrix();
///////////////////////////////////////////////////////////////
//构建场景
///////////////////////////////////////////////////////////////
glPushMatrix();
glTranslatef(0.0,-0.5,-5.0);
glTranslatef(0.0,0.0,size);
glRotatef(step,0.0,1.0,0.0);
glColor3f(1.0,1.0,1.0);
glLoadName(51);
DrawDesk();
DrawLib();
DrawCupBoard();
DrawCupBoard_1();
DrawCupBoard_2();
glPopName();
glPopMatrix();
///////////////////////////////////////////
// OnDrawEquip();
////////////////////////////////////////////////////////////////
glPopMatrix();
//glFlush();
::SwapBuffers(m_pDC->GetSafeHdc()); //交互缓冲区
return TRUE;
} |
|