void device_entercontext(device_t device) { HDC hdc = device->plat->swap.wi->hdc; if (device->cur_swap) hdc = device->cur_swap->wi->hdc; if (!wgl_make_current(hdc, device->plat->hrc)) blog(LOG_ERROR, "device_load_swapchain (GL) failed"); }
static inline HGLRC gl_init_basic_context(HDC hdc) { HGLRC hglrc = wglCreateContext(hdc); if (!hglrc) { blog(LOG_ERROR, "wglCreateContext failed, %u", GetLastError()); return NULL; } if (!wgl_make_current(hdc, hglrc)) { wglDeleteContext(hglrc); return NULL; } return hglrc; }
void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swap) { HDC hdc = device->plat->window.hdc; if (device->cur_swap == swap) return; device->cur_swap = swap; if (swap) hdc = swap->wi->hdc; if (hdc) { if (!wgl_make_current(hdc, device->plat->hrc)) blog(LOG_ERROR, "device_load_swapchain (GL) failed"); } }
void device_load_swapchain(device_t device, swapchain_t swap) { HDC hdc; if (!swap) swap = &device->plat->swap; if (device->cur_swap == swap) return; device->cur_swap = swap; if (swap) hdc = swap->wi->hdc; if (!wgl_make_current(hdc, device->plat->hrc)) blog(LOG_ERROR, "device_load_swapchain (GL) failed"); }
static inline HGLRC gl_init_context(HDC hdc) { #ifdef _DEBUG if (wgl_ext_ARB_create_context) { HGLRC hglrc = wglCreateContextAttribsARB(hdc, 0, attribs); if (!hglrc) { blog(LOG_ERROR, "wglCreateContextAttribsARB failed, %u", GetLastError()); return NULL; } if (!wgl_make_current(hdc, hglrc)) { wglDeleteContext(hglrc); return NULL; } return hglrc; } #endif return gl_init_basic_context(hdc); }