怎么将win32控制台程序转换为MFC应用程序

如何将win32控制台程序转换为MFC应用程序?
这是我的win32控制台程序,如何将其转换为MFC应用程序?
// Earth.cpp : 
//

#include "stdafx.h"
#include <string.h>
#include "glut.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

#define BMP_Header_Length 54

GLuint Earth;
GLUquadricObj *qobj;
GLdouble spin = 0.0;
GLfloat xoffset;
static GLfloat day = 0;
static GLfloat pi = 3.141592653;

//////////////////////轨道根数/////////////////////
GLfloat a=1.2;//轨道半径
GLfloat e=0.1;//轨道偏心率
GLfloat W=-45;//升交点赤经
GLfloat w=45;//近地点角距
GLfloat i=45;//轨道倾角
GLfloat t=0;//过近地点时刻


//////////////////////////////////////////////////

int power_of_two(int n)
{
if( n <= 0 )
return 0;
return (n & (n-1)) == 0;
}

GLuint load_texture(const char* file_name){

GLint width, height, totoal_bytes;
GLubyte* pixels = 0;
GLint last_texture_ID;
GLuint texture_ID = 0;

FILE* pFile = fopen(file_name, "rb");
if( pFile == 0 )
return 0;

fseek(pFile, 0x0012, SEEK_SET);
fread(&width, 4, 1, pFile);
fread(&height, 4, 1, pFile);
fseek(pFile, BMP_Header_Length, SEEK_SET);

{
GLint line_byte = width * 3;
while( line_byte % 4 != 0 )
++line_byte;
totoal_bytes = line_byte * height;
}

pixels = (GLubyte*)malloc(totoal_bytes);
if ( pixels == 0 ) {
fclose(pFile);
return 0;
}

if ( fread(pixels, totoal_bytes, 1, pFile) <= 0 ) {
free(pixels);
fclose(pFile);
return 0;
}

{
GLint max;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max);
if ( !power_of_two(width)
|| !power_of_two(height)
|| width > max
|| height > max) {
const GLint new_width = 256;
const GLint new_height = 256;

GLint new_line_bytes, new_total_bytes;
GLubyte* new_pixels = 0;

new_line_bytes = new_width * 3;
while( new_line_bytes % 4 != 0 )
++new_line_bytes;
new_total_bytes = new_line_bytes * new_height;

new_pixels = (GLubyte*)malloc(new_total_bytes);
if( new_pixels == 0 )
{
free(pixels);
fclose(pFile);
return 0;
}

gluScaleImage(GL_RGB,
width, height, GL_UNSIGNED_BYTE, pixels,
new_width, new_height, GL_UNSIGNED_BYTE, new_pixels);

free(pixels);
pixels = new_pixels;
width = new_width;
height = new_height;

}
}

glGenTextures(1, &texture_ID);
if( texture_ID == 0 )
{
free(pixels);
fclose(pFile);
return 0;
}

glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture_ID);
glBindTexture(GL_TEXTURE_2D, texture_ID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0,
GL_BGR_EXT, GL_UNSIGNED_BYTE, pixels);
glBindTexture(GL_TEXTURE_2D, last_texture_ID);

free(pixels);
return texture_ID;
}

void drawSatellite()
{
GLfloat lmodel_ambient[]={ 1.0, 1.0, 1.0, 1.0 };
GLfloat light_position[]={ 1.0, 1.0, 1.0, 0.0 };
GLfloat yellow_light[]={ 1.0, 0.5, 0.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glLightfv(GL_LIGHT0, GL_DIFFUSE, yellow_light);
glLightfv(GL_LIGHT0, GL_SPECULAR, yellow_light);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
glEnable(GL_LIGHTING);