在MFC中使用opengl作图
来源:百度知道 编辑:UC知道 时间:2024/06/06 20:09:34
急求在MFC中使用opengl作图的方法
请解释得尽量详细
最好有实际的程序例子
请解释得尽量详细
最好有实际的程序例子
MFC的程序太大,文件太多,这里贴不完,你可以去这个地址看看,学Opengl我是从这里入门的:http://nehe.gamedev.net
一个MFC的程序部分如下:
#include "stdafx.h"
#include "NeheMFC.h"
#include "NeheWindow.h"
#include "Main.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
static float angle=0,rot1,rot2;
CMain::CMain()
{
// Start Of User Initialization
}
CMain::~CMain()
{
}
BOOL CMain::KeyPressed(int nCode)
{
if( nCode >= 0 && nCode <= 255 )
{
return theApp.keyDown[ nCode ];
}
return FALSE;
}
BOOL CMain::Initialize()
{
angle = 0.0f; // Set Starting Angle To Zero
glClearColor (0.0f, 0.0f, 0.0f, 0.5f); // Black Background
glClearDepth (1.0f);