Extern "C" _ declspec (dllexport) void Init (HWND hWnd ); Extern "C" _ declspec (dllexport) void Render (); Void Init (HWND hWnd) { Int PixelFormat; Int bits = 16; HDC = GetDC (hWnd ); Static PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be { Sizeof (PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format Bits, // Select Our Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0, // No Alpha Buffer 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored 16, // 16Bit Z-Buffer (Depth Buffer) 0, // No stencel Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; PixelFormat = ChoosePixelFormat (hDC, & pfd ); SetPixelFormat (hDC, PixelFormat, & pfd ); HRC = wglCreateContext (hDC ); } Void Render () { WglMakeCurrent (hDC, hRC ); Draw (); SwapBuffers (hDC ); WglMakeCurrent (NULL, NULL ); } |