mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
[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:
parent
6f56f98714
commit
55d3193b5f
1 changed files with 25 additions and 1 deletions
|
@ -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
|
||||
wgl_create_context (gl_ctx_t *ctx)
|
||||
{
|
||||
DWORD lasterror;
|
||||
|
||||
Sys_Printf ("maindc: %p\n", win_maindc);
|
||||
win_maindc = GetDC (win_mainwindow);
|
||||
|
||||
wgl_set_pixel_format ();
|
||||
baseRC = qfwglCreateContext (win_maindc);
|
||||
if (!baseRC) {
|
||||
lasterror=GetLastError();
|
||||
|
|
Loading…
Reference in a new issue