* See also:
* - http://www.opengl.org/archives/resources/faq/technical/mswindows.htm
*/
-static __PFNWGLCHOOSEPIXELFORMAT pfnChoosePixelFormat = &ChoosePixelFormat;
-static __PFNWGLSETPIXELFORMAT pfnSetPixelFormat = &SetPixelFormat;
-static __PFNWGLSWAPBUFFERS pfnSwapBuffers = &SwapBuffers;
+static PFN_WGLCHOOSEPIXELFORMAT pfnChoosePixelFormat = &ChoosePixelFormat;
+static PFN_WGLSETPIXELFORMAT pfnSetPixelFormat = &SetPixelFormat;
+static PFN_WGLSWAPBUFFERS pfnSwapBuffers = &SwapBuffers;
static LRESULT CALLBACK
{
MINMAXINFO *pMMI;
switch (uMsg) {
+ case WM_KEYDOWN:
+ switch (wParam) {
+ case VK_ESCAPE:
+ PostMessage(hWnd, WM_CLOSE, 0, 0);
+ break;
+ }
+ break;
case WM_GETMINMAXINFO:
// Allow to create a window bigger than the desktop
pMMI = (MINMAXINFO *)lParam;
pMMI->ptMaxTrackSize.x = 60000;
pMMI->ptMaxTrackSize.y = 60000;
break;
+ case WM_CLOSE:
+ exit(0);
+ break;
default:
break;
}
PIXELFORMATDESCRIPTOR pfd;
int iPixelFormat;
- WglDrawable(const Visual *vis, int width, int height) :
- Drawable(vis, width, height)
+ WglDrawable(const Visual *vis, int width, int height, bool pbuffer) :
+ Drawable(vis, width, height, pbuffer)
{
static bool first = TRUE;
RECT rect;
libgl_filename = "OPENGL32";
}
- __libGlHandle = LoadLibraryA(libgl_filename);
- if (!__libGlHandle) {
+ _libGlHandle = LoadLibraryA(libgl_filename);
+ if (!_libGlHandle) {
std::cerr << "error: unable to open " << libgl_filename << "\n";
exit(1);
}
}
Drawable *
-createDrawable(const Visual *visual, int width, int height)
+createDrawable(const Visual *visual, int width, int height, bool pbuffer)
{
- return new WglDrawable(visual, width, height);
+ return new WglDrawable(visual, width, height, pbuffer);
}
Context *
-createContext(const Visual *visual, Context *shareContext, Profile profile)
+createContext(const Visual *visual, Context *shareContext, Profile profile, bool debug)
{
if (profile != PROFILE_COMPAT) {
return NULL;
bool
processEvents(void) {
- // TODO
+ MSG uMsg;
+ while (PeekMessage(&uMsg, NULL, 0, 0, PM_REMOVE)) {
+ if (uMsg.message == WM_QUIT) {
+ return false;
+ }
+
+ if (!TranslateAccelerator(uMsg.hwnd, NULL, &uMsg)) {
+ TranslateMessage(&uMsg);
+ DispatchMessage(&uMsg);
+ }
+ }
return true;
}