mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Fixed a bug in copy_to_texture for depth buffers
This commit is contained in:
parent
8c39891d66
commit
0a4633cf81
@ -27,3 +27,33 @@
|
||||
DrawableRegion::
|
||||
~DrawableRegion() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DrawableRegion::get_renderbuffer_type
|
||||
// Access: Static, Published
|
||||
// Description: Returns the RenderBuffer::Type that corresponds
|
||||
// to a RenderTexturePlane.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int DrawableRegion::
|
||||
get_renderbuffer_type(int rtp) {
|
||||
switch(rtp) {
|
||||
case RTP_stencil: return RenderBuffer::T_stencil;
|
||||
case RTP_depth: return RenderBuffer::T_depth;
|
||||
case RTP_color: return RenderBuffer::T_color;
|
||||
case RTP_aux_rgba_0: return RenderBuffer::T_aux_rgba_0;
|
||||
case RTP_aux_rgba_1: return RenderBuffer::T_aux_rgba_1;
|
||||
case RTP_aux_rgba_2: return RenderBuffer::T_aux_rgba_2;
|
||||
case RTP_aux_rgba_3: return RenderBuffer::T_aux_rgba_3;
|
||||
case RTP_aux_hrgba_0: return RenderBuffer::T_aux_hrgba_0;
|
||||
case RTP_aux_hrgba_1: return RenderBuffer::T_aux_hrgba_1;
|
||||
case RTP_aux_hrgba_2: return RenderBuffer::T_aux_hrgba_2;
|
||||
case RTP_aux_hrgba_3: return RenderBuffer::T_aux_hrgba_3;
|
||||
case RTP_aux_float_0: return RenderBuffer::T_aux_float_0;
|
||||
case RTP_aux_float_1: return RenderBuffer::T_aux_float_1;
|
||||
case RTP_aux_float_2: return RenderBuffer::T_aux_float_2;
|
||||
case RTP_aux_float_3: return RenderBuffer::T_aux_float_3;
|
||||
default:
|
||||
display_cat.error() << "DrawableRegion::get_renderbuffer_type unexpected case!\n";
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
@ -95,6 +95,8 @@ PUBLISHED:
|
||||
|
||||
INLINE bool is_any_clear_active() const;
|
||||
|
||||
static int get_renderbuffer_type(int plane);
|
||||
|
||||
public:
|
||||
INLINE int get_screenshot_buffer_type() const;
|
||||
INLINE int get_draw_buffer_type() const;
|
||||
|
@ -1007,8 +1007,13 @@ copy_to_textures() {
|
||||
display_cat.debug()
|
||||
<< "cube_map_index = " << _cube_map_index << "\n";
|
||||
}
|
||||
RenderBuffer buffer = _gsg->get_render_buffer(get_draw_buffer_type(),
|
||||
int plane = get_texture_plane(i);
|
||||
RenderBuffer buffer(_gsg, DrawableRegion::get_renderbuffer_type(plane));
|
||||
if (plane == RTP_color) {
|
||||
buffer = _gsg->get_render_buffer(get_draw_buffer_type(),
|
||||
get_fb_properties());
|
||||
}
|
||||
|
||||
if (_cube_map_dr != (DisplayRegion *)NULL) {
|
||||
if ((rtm_mode == RTM_copy_ram)||(rtm_mode == RTM_triggered_copy_ram)) {
|
||||
_gsg->framebuffer_copy_to_ram(texture, _cube_map_index,
|
||||
|
@ -4800,6 +4800,11 @@ set_draw_buffer(int rbtype) {
|
||||
void CLP(GraphicsStateGuardian)::
|
||||
set_read_buffer(int rbtype) {
|
||||
|
||||
if (rbtype & (RenderBuffer::T_depth | RenderBuffer::T_stencil)) {
|
||||
// Special case: don't have to call ReadBuffer for these.
|
||||
return;
|
||||
}
|
||||
|
||||
if (_current_fbo) {
|
||||
|
||||
GLuint buffer = GL_COLOR_ATTACHMENT0_EXT;
|
||||
|
Loading…
x
Reference in New Issue
Block a user