На самом деле вам даже не нужен GLUT, он уже есть, нужно только связать его с libopengl32.a, который свяжет исполняемый файл с собственным opengl32.dll в системе.
typedef struct RENDER_SURFACE {
void (*redraw)(struct RENDER_SURFACE*);
HWND hWnd;
HINSTANCE hInstance;
HDC hdc;
HGLRC hrc;
int width;
int height;
int pix_fmt;
float light_position[4];
float light_ambient[4];
float light_diffuse[4];
float light_specular[4];
float light_shininess;
} RENDER_SURFACE;
static LRESULT AppProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
RENDER_SURFACE* rs = (RENDER_SURFACE*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if (uMsg == WM_CREATE)
{
RECT rc;
PIXELFORMATDESCRIPTOR pfd;
rs = (RENDER_SURFACE*)((LPCREATESTRUCT)lParam)->lpCreateParams;
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)rs);
rs->hWnd = hWnd;
rs->hdc = GetDC(hWnd);
GetClientRect(hWnd, &rc);
rs->width = rc.right-rc.left;
rs->height = rc.bottom-rc.top;
memset(&pfd, 0, sizeof(pfd));
pfd.nSize = sizeof(pfd);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL;
pfd.cColorBits = 24;
pfd.cDepthBits = 32;
rs->pix_fmt = ChoosePixelFormat(rs->hdc, &pfd);
if (!rs->pix_fmt)
{
MessageBox(hWnd, "ChoosePixelFormat FAILED!", "Fatal Error", MB_OK | MB_ICONSTOP);
DestroyWindow(hWnd);
return -1;
}
SetPixelFormat(rs->hdc, rs->pix_fmt, &pfd);
rs->hrc = wglCreateContext(rs->hdc);
wglMakeCurrent(rs->hdc, rs->hrc);
/* SwapBuffers(rs->hdc); */
return 0;
}
else if (uMsg == WM_PAINT)
{
/* other stuffs */
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}