[vid] Set pixel format for OpenGL

This gets the GL and GLSL renderers working for the -win targets... sort
of: they are upside down and GLSL's bsp surfaces are black (same as
Vulkan). However, with this, all 5 renderers at least limp along for
-win, 4/5 work for -sdl.
This commit is contained in:
Bill Currie 2021-03-31 16:25:19 +09:00
parent 6f56f98714
commit 55d3193b5f

View file

@ -94,12 +94,36 @@ wgl_choose_visual (gl_ctx_t *ctx)
{ {
} }
static void
wgl_set_pixel_format (void)
{
int pixelformat;
PIXELFORMATDESCRIPTOR pfd = {
.nSize = sizeof(PIXELFORMATDESCRIPTOR),
.nVersion = 1,
.dwFlags = PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW,
.iPixelType = PFD_TYPE_RGBA,
.cColorBits = win_gdevmode.dmBitsPerPel,
.cDepthBits = 32,
.iLayerType = PFD_MAIN_PLANE,
};
if (!(pixelformat = ChoosePixelFormat (win_maindc, &pfd))) {
Sys_Error ("ChoosePixelFormat failed");
}
if (!SetPixelFormat (win_maindc, pixelformat, &pfd)) {
Sys_Error ("SetPixelFormat failed");
}
}
static void static void
wgl_create_context (gl_ctx_t *ctx) wgl_create_context (gl_ctx_t *ctx)
{ {
DWORD lasterror; DWORD lasterror;
Sys_Printf ("maindc: %p\n", win_maindc); win_maindc = GetDC (win_mainwindow);
wgl_set_pixel_format ();
baseRC = qfwglCreateContext (win_maindc); baseRC = qfwglCreateContext (win_maindc);
if (!baseRC) { if (!baseRC) {
lasterror=GetLastError(); lasterror=GetLastError();