mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
try some more to get pbuffers to work without call to SwapBuffers
This commit is contained in:
parent
b0de5200b0
commit
11f94c964a
@ -42,6 +42,14 @@ wglGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
|||||||
_window_dc = (HDC)0;
|
_window_dc = (HDC)0;
|
||||||
_pbuffer = (HPBUFFERARB)0;
|
_pbuffer = (HPBUFFERARB)0;
|
||||||
_pbuffer_dc = (HDC)0;
|
_pbuffer_dc = (HDC)0;
|
||||||
|
|
||||||
|
// Since the pbuffer (or window, if we use a hidden window) never
|
||||||
|
// gets flipped, we get screenshots from the same buffer we draw
|
||||||
|
// into.
|
||||||
|
|
||||||
|
// Actually, because of an apparent driver bug in nVidia drivers, we
|
||||||
|
// must flip the pbuffer after all.
|
||||||
|
// _screenshot_buffer_type = _draw_buffer_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -123,9 +131,23 @@ end_frame() {
|
|||||||
// texture in the first place (but I don't have a card that
|
// texture in the first place (but I don't have a card that
|
||||||
// supports that right now).
|
// supports that right now).
|
||||||
nassertv(has_texture());
|
nassertv(has_texture());
|
||||||
|
|
||||||
DisplayRegion dr(this, _x_size, _y_size);
|
DisplayRegion dr(this, _x_size, _y_size);
|
||||||
RenderBuffer buffer = _gsg->get_render_buffer(get_draw_buffer_type());
|
RenderBuffer buffer = _gsg->get_render_buffer(get_draw_buffer_type());
|
||||||
get_texture()->copy(_gsg, &dr, buffer);
|
get_texture()->copy(_gsg, &dr, buffer);
|
||||||
|
|
||||||
|
// It appears that the nVidia graphics driver 5.3.0.3, dated
|
||||||
|
// 11/17/2003 will get confused with the above copy operation and
|
||||||
|
// copy the texture from the wrong window, unless we immediately
|
||||||
|
// swap buffers in the pbuffer, even though there's no reason to
|
||||||
|
// swap buffers otherwise. This is unfortunate, because it means
|
||||||
|
// we can't use single-buffered pbuffers (for which SwapBuffers is
|
||||||
|
// a no-op).
|
||||||
|
if (_pbuffer_dc) {
|
||||||
|
SwapBuffers(_pbuffer_dc);
|
||||||
|
} else if (_window_dc) {
|
||||||
|
SwapBuffers(_window_dc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,38 +188,6 @@ release_gsg() {
|
|||||||
GraphicsBuffer::release_gsg();
|
GraphicsBuffer::release_gsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: wglGraphicsBuffer::begin_flip
|
|
||||||
// Access: Public, Virtual
|
|
||||||
// Description: This function will be called within the draw thread
|
|
||||||
// after end_frame() has been called on all windows, to
|
|
||||||
// initiate the exchange of the front and back buffers.
|
|
||||||
//
|
|
||||||
// This should instruct the window to prepare for the
|
|
||||||
// flip at the next video sync, but it should not wait.
|
|
||||||
//
|
|
||||||
// We have the two separate functions, begin_flip() and
|
|
||||||
// end_flip(), to make it easier to flip all of the
|
|
||||||
// windows at the same time.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void wglGraphicsBuffer::
|
|
||||||
begin_flip() {
|
|
||||||
// In principle, we shouldn't need to flip the pbuffer. But it
|
|
||||||
// seems that if we don't, at least on my nVidia driver, it won't
|
|
||||||
// copy to texture properly somehow.
|
|
||||||
|
|
||||||
if (_gsg != (GraphicsStateGuardian *)NULL) {
|
|
||||||
make_current();
|
|
||||||
glFinish();
|
|
||||||
|
|
||||||
if (_pbuffer_dc) {
|
|
||||||
SwapBuffers(_pbuffer_dc);
|
|
||||||
} else {
|
|
||||||
SwapBuffers(_window_dc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: wglGraphicsBuffer::process_events
|
// Function: wglGraphicsBuffer::process_events
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
@ -300,6 +290,8 @@ open_buffer() {
|
|||||||
DestroyWindow(_window);
|
DestroyWindow(_window);
|
||||||
_window = 0;
|
_window = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SwapBuffers(_pbuffer_dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
_is_valid = true;
|
_is_valid = true;
|
||||||
|
@ -52,8 +52,6 @@ public:
|
|||||||
virtual void make_current();
|
virtual void make_current();
|
||||||
virtual void release_gsg();
|
virtual void release_gsg();
|
||||||
|
|
||||||
virtual void begin_flip();
|
|
||||||
|
|
||||||
virtual void process_events();
|
virtual void process_events();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -200,9 +200,7 @@ release_gsg() {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void wglGraphicsWindow::
|
void wglGraphicsWindow::
|
||||||
begin_flip() {
|
begin_flip() {
|
||||||
if (_gsg != (GraphicsStateGuardian *)NULL) {
|
if (_hdc) {
|
||||||
make_current();
|
|
||||||
glFinish();
|
|
||||||
SwapBuffers(_hdc);
|
SwapBuffers(_hdc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user