22 bool wglGraphicsPipe::_current_valid;
23 HDC wglGraphicsPipe::_current_hdc;
24 HGLRC wglGraphicsPipe::_current_hglrc;
25 Thread *wglGraphicsPipe::_current_thread;
32 _current_valid =
false;
45 bool wglGraphicsPipe::
46 wgl_make_current(HDC hdc, HGLRC hglrc,
PStatCollector *collector) {
48 if ((_current_valid) &&
49 (_current_hdc == hdc) &&
50 (_current_hglrc == hglrc) &&
51 (_current_thread == thread)) {
54 _current_valid =
true;
56 _current_hglrc = hglrc;
57 _current_thread = thread;
61 res = wglMakeCurrent(hdc, hglrc);
63 res = wglMakeCurrent(hdc, hglrc);
93 make_output(
const std::string &name,
109 DCAST_INTO_R(wglgsg, gsg,
nullptr);
117 support_render_texture;
123 if (((flags&BF_require_parasite)!=0)||
124 ((flags&BF_refuse_window)!=0)||
125 ((flags&BF_resizeable)!=0)||
126 ((flags&BF_size_track_host)!=0)||
127 ((flags&BF_rtt_cumulative)!=0)||
128 ((flags&BF_can_bind_color)!=0)||
129 ((flags&BF_can_bind_every)!=0)||
130 ((flags&BF_can_bind_layered)!=0)) {
133 if ((flags & BF_fb_props_optional)==0) {
134 if ((fb_prop.get_aux_rgba() > 0)||
135 (fb_prop.get_aux_hrgba() > 0)||
136 (fb_prop.get_aux_float() > 0)) {
147 if (!gl_support_fbo || host ==
nullptr ||
148 (flags & (BF_require_parasite | BF_require_window)) != 0) {
153 if ((flags & BF_fb_props_optional) == 0) {
154 if (fb_prop.get_indexed_color() ||
155 fb_prop.get_back_buffers() > 0 ||
156 fb_prop.get_accum_bits() > 0) {
160 if (wglgsg !=
nullptr && wglgsg->is_valid() && !wglgsg->needs_reset()) {
161 if (!wglgsg->_supports_framebuffer_object ||
162 wglgsg->_glDrawBuffers ==
nullptr) {
170 return new GLGraphicsBuffer(engine,
this, name, fb_prop, win_prop,
177 if (((flags&BF_require_parasite)!=0)||
178 ((flags&BF_require_window)!=0)||
179 ((flags&BF_can_bind_layered)!=0)) {
183 (wglgsg->is_valid()) &&
184 (!wglgsg->needs_reset()) &&
185 !wglgsg->_supports_pbuffer) {
190 if (((flags&BF_rtt_cumulative)!=0)||
191 ((flags&BF_can_bind_every)!=0)) {
200 if ((flags & BF_fb_props_optional) == 0) {
201 if ((fb_prop.get_aux_rgba() > 0)||
202 (fb_prop.get_aux_rgba() > 0)||
203 (fb_prop.get_aux_float() > 0)) {
210 (wglgsg->is_valid()) &&
211 (!wglgsg->needs_reset()) &&
240 std::string wglGraphicsPipe::
241 format_pfd_flags(DWORD pfd_flags) {
246 static FlagDef flag_def[] = {
247 { PFD_DRAW_TO_WINDOW,
"PFD_DRAW_TO_WINDOW" },
248 { PFD_DRAW_TO_BITMAP,
"PFD_DRAW_TO_BITMAP" },
249 { PFD_SUPPORT_GDI,
"PFD_SUPPORT_GDI" },
250 { PFD_SUPPORT_OPENGL,
"PFD_SUPPORT_OPENGL" },
251 { PFD_GENERIC_ACCELERATED,
"PFD_GENERIC_ACCELERATED" },
252 { PFD_GENERIC_FORMAT,
"PFD_GENERIC_FORMAT" },
253 { PFD_NEED_PALETTE,
"PFD_NEED_PALETTE" },
254 { PFD_NEED_SYSTEM_PALETTE,
"PFD_NEED_SYSTEM_PALETTE" },
255 { PFD_DOUBLEBUFFER,
"PFD_DOUBLEBUFFER" },
256 { PFD_STEREO,
"PFD_STEREO" },
257 { PFD_SWAP_LAYER_BUFFERS,
"PFD_SWAP_LAYER_BUFFERS" },
258 { PFD_SWAP_COPY,
"PFD_SWAP_COPY" },
259 { PFD_SWAP_EXCHANGE,
"PFD_SWAP_EXCHANGE" },
261 static const int num_flag_defs =
sizeof(flag_def) /
sizeof(FlagDef);
263 std::ostringstream out;
265 const char *sep =
"";
266 bool got_any =
false;
267 for (
int i = 0; i < num_flag_defs; i++) {
268 if (pfd_flags & flag_def[i].flag) {
269 out << sep << flag_def[i].name;
270 pfd_flags &= ~flag_def[i].flag;
276 if (pfd_flags != 0 || !got_any) {
277 out << sep << std::hex <<
"0x" << pfd_flags << std::dec;