22bool wglGraphicsPipe::_current_valid;
23HDC wglGraphicsPipe::_current_hdc;
24HGLRC wglGraphicsPipe::_current_hglrc;
25Thread *wglGraphicsPipe::_current_thread;
32 _current_valid =
false;
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);
93make_output(
const std::string &name,
109 DCAST_INTO_R(wglgsg, gsg,
nullptr);
116 wglgsg -> get_supports_wgl_render_texture() &&
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()) &&
240std::string wglGraphicsPipe::
241format_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;
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
bool subsumes(const FrameBufferProperties &other) const
Returns true if this set of properties makes strictly greater or equal demands of the framebuffer tha...
This class is the main interface to controlling the render process.
This is a base class for the various different classes that represent the result of a frame of render...
An object to create GraphicsOutputs that share a particular 3-D API.
Encapsulates all the communication with a particular instance of a given rendering backend.
A lightweight class that represents a single element that may be timed and/or counted via stats.
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
A thread; that is, a lightweight process.
get_current_thread
Returns a pointer to the currently-executing Thread object.
TypeHandle is the identifier used to differentiate C++ class types.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
An offscreen render buffer.
This graphics pipe represents the interface for creating OpenGL graphics windows on the various Windo...
virtual std::string get_interface_name() const
Returns the name of the rendering interface associated with this GraphicsPipe.
A tiny specialization on GLGraphicsStateGuardian to add some wgl-specific information.
bool pfnum_supports_pbuffer() const
Returns true if the gsg's pixel format is capable of supporting a pbuffer.
const FrameBufferProperties & get_fb_properties() const
Returns the properties of the pixel format that was chosen for this gsg.
A single graphics window for rendering OpenGL under Microsoft Windows.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.