mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
check framebuffer properties for match when creating pbuffer
This commit is contained in:
parent
31cc2f4d8f
commit
dba1064551
@ -264,7 +264,7 @@ open_buffer() {
|
||||
<< "Created PBuffer " << _pbuffer << ", DC " << _pbuffer_dc << "\n";
|
||||
|
||||
wglMakeCurrent(_pbuffer_dc, wglgsg->get_context(_pbuffer_dc));
|
||||
wglgsg->report_gl_errors();
|
||||
wglgsg->report_my_gl_errors();
|
||||
|
||||
// Now that the pbuffer is created, we don't need the window any
|
||||
// more.
|
||||
@ -400,6 +400,12 @@ make_pbuffer() {
|
||||
iattrib_list[ni++] = WGL_STENCIL_BITS_ARB;
|
||||
iattrib_list[ni++] = pfd.cStencilBits;
|
||||
|
||||
// Match up properties.
|
||||
iattrib_list[ni++] = WGL_DOUBLE_BUFFER_ARB;
|
||||
iattrib_list[ni++] = ((pfd.dwFlags & PFD_DOUBLEBUFFER) != 0);
|
||||
iattrib_list[ni++] = WGL_STEREO_ARB;
|
||||
iattrib_list[ni++] = ((pfd.dwFlags & PFD_STEREO) != 0);
|
||||
|
||||
// Terminate the lists.
|
||||
nassertr(ni < max_attrib_list && nf < max_attrib_list, NULL);
|
||||
iattrib_list[ni] = 0;
|
||||
|
@ -277,8 +277,8 @@ find_pixfmtnum(FrameBufferProperties &properties, HDC hdc,
|
||||
<< "stencil = " << (int)(pfd.cStencilBits) << "\n";
|
||||
}
|
||||
wgldisplay_cat.debug()
|
||||
<< "flags = " << hex << (int)(pfd.dwFlags) << " (missing "
|
||||
<< (int)((~pfd.dwFlags) & dwReqFlags) << dec << ")\n";
|
||||
<< "flags = " << format_pfd_flags(pfd.dwFlags) << " (missing "
|
||||
<< format_pfd_flags((~pfd.dwFlags) & dwReqFlags) << ")\n";
|
||||
}
|
||||
|
||||
if ((frame_buffer_mode & FrameBufferProperties::FM_alpha) != 0 &&
|
||||
@ -360,3 +360,52 @@ find_pixfmtnum(FrameBufferProperties &properties, HDC hdc,
|
||||
|
||||
return found_pfnum;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: wglGraphicsPipe::format_pfd_flags
|
||||
// Access: Private, Static
|
||||
// Description: Returns pfd_flags formatted as a string in a
|
||||
// user-friendly way.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
string wglGraphicsPipe::
|
||||
format_pfd_flags(DWORD pfd_flags) {
|
||||
struct FlagDef {
|
||||
DWORD flag;
|
||||
const char *name;
|
||||
};
|
||||
static FlagDef flag_def[] = {
|
||||
{ PFD_DRAW_TO_WINDOW, "PFD_DRAW_TO_WINDOW" },
|
||||
{ PFD_DRAW_TO_BITMAP, "PFD_DRAW_TO_BITMAP" },
|
||||
{ PFD_SUPPORT_GDI, "PFD_SUPPORT_GDI" },
|
||||
{ PFD_SUPPORT_OPENGL, "PFD_SUPPORT_OPENGL" },
|
||||
{ PFD_GENERIC_ACCELERATED, "PFD_GENERIC_ACCELERATED" },
|
||||
{ PFD_GENERIC_FORMAT, "PFD_GENERIC_FORMAT" },
|
||||
{ PFD_NEED_PALETTE, "PFD_NEED_PALETTE" },
|
||||
{ PFD_NEED_SYSTEM_PALETTE, "PFD_NEED_SYSTEM_PALETTE" },
|
||||
{ PFD_DOUBLEBUFFER, "PFD_DOUBLEBUFFER" },
|
||||
{ PFD_STEREO, "PFD_STEREO" },
|
||||
{ PFD_SWAP_LAYER_BUFFERS, "PFD_SWAP_LAYER_BUFFERS" },
|
||||
{ PFD_SWAP_COPY, "PFD_SWAP_COPY" },
|
||||
{ PFD_SWAP_EXCHANGE, "PFD_SWAP_EXCHANGE" },
|
||||
};
|
||||
static const int num_flag_defs = sizeof(flag_def) / sizeof(FlagDef);
|
||||
|
||||
ostringstream out;
|
||||
|
||||
const char *sep = "";
|
||||
bool got_any = false;
|
||||
for (int i = 0; i < num_flag_defs; i++) {
|
||||
if (pfd_flags & flag_def[i].flag) {
|
||||
out << sep << flag_def[i].name;
|
||||
pfd_flags &= ~flag_def[i].flag;
|
||||
sep = "|";
|
||||
got_any = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pfd_flags != 0 || !got_any) {
|
||||
out << sep << hex << "0x" << pfd_flags << dec;
|
||||
}
|
||||
|
||||
return out.str();
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ private:
|
||||
static int choose_pfnum(FrameBufferProperties &properties, HDC hdc);
|
||||
static int find_pixfmtnum(FrameBufferProperties &properties, HDC hdc,
|
||||
bool bLookforHW);
|
||||
static string format_pfd_flags(DWORD pfd_flags);
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user