mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
something's broken with FBO-based cube maps and the depth buffer. Needs more research.
This commit is contained in:
parent
3345f207b8
commit
abf84dbd0a
@ -146,8 +146,8 @@ begin_frame(FrameMode mode, Thread *current_thread) {
|
|||||||
|
|
||||||
// Figure out the desired size of the buffer.
|
// Figure out the desired size of the buffer.
|
||||||
if (mode == FM_render) {
|
if (mode == FM_render) {
|
||||||
rebuild_bitplanes();
|
|
||||||
clear_cube_map_selection();
|
clear_cube_map_selection();
|
||||||
|
rebuild_bitplanes();
|
||||||
if (!check_fbo()) {
|
if (!check_fbo()) {
|
||||||
if (GLCAT.is_debug()) {
|
if (GLCAT.is_debug()) {
|
||||||
GLCAT.debug()
|
GLCAT.debug()
|
||||||
@ -234,8 +234,12 @@ rebuild_bitplanes() {
|
|||||||
if (tex == 0) {
|
if (tex == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
RenderTextureMode rtm_mode = get_rtm_mode(0);
|
||||||
|
|
||||||
if (tex->get_texture_type() != Texture::TT_cube_map) {
|
if (tex->get_texture_type() != Texture::TT_cube_map ||
|
||||||
|
rtm_mode != RTM_bind_or_copy) {
|
||||||
|
// We're not rendering directly to a cube map, so set up the
|
||||||
|
// framebuffers normally.
|
||||||
if (_fbo == 0) {
|
if (_fbo == 0) {
|
||||||
glgsg->_glGenFramebuffers(1, &_fbo);
|
glgsg->_glGenFramebuffers(1, &_fbo);
|
||||||
if (_fbo == 0) {
|
if (_fbo == 0) {
|
||||||
@ -287,7 +291,7 @@ rebuild_bitplanes() {
|
|||||||
// Sort the textures list into appropriate slots.
|
// Sort the textures list into appropriate slots.
|
||||||
|
|
||||||
{
|
{
|
||||||
CDLockedReader cdata(_cycler);
|
CDReader cdata(_cycler);
|
||||||
for (size_t i = 0; i != cdata->_textures.size(); ++i) {
|
for (size_t i = 0; i != cdata->_textures.size(); ++i) {
|
||||||
const RenderTexture &rt = cdata->_textures[i];
|
const RenderTexture &rt = cdata->_textures[i];
|
||||||
RenderTextureMode rtm_mode = rt._rtm_mode;
|
RenderTextureMode rtm_mode = rt._rtm_mode;
|
||||||
@ -298,20 +302,16 @@ rebuild_bitplanes() {
|
|||||||
RenderTexturePlane plane = rt._plane;
|
RenderTexturePlane plane = rt._plane;
|
||||||
|
|
||||||
// If it's a not a 2D texture or a cube map, punt it.
|
// If it's a not a 2D texture or a cube map, punt it.
|
||||||
if ((tex->get_texture_type() != Texture::TT_2d_texture)&&
|
if ((tex->get_texture_type() != Texture::TT_2d_texture) &&
|
||||||
(tex->get_texture_type() != Texture::TT_cube_map)) {
|
(tex->get_texture_type() != Texture::TT_cube_map)) {
|
||||||
CDWriter cdataw(_cycler, cdata, false);
|
((CData *)cdata.p())->_textures[i]._rtm_mode = RTM_copy_texture;
|
||||||
nassertv(cdata->_textures.size() == cdataw->_textures.size());
|
|
||||||
cdataw->_textures[i]._rtm_mode = RTM_copy_texture;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// If I can't find an appropriate slot, or if there's
|
// If I can't find an appropriate slot, or if there's
|
||||||
// already a texture bound to this slot, then punt
|
// already a texture bound to this slot, then punt
|
||||||
// this texture.
|
// this texture.
|
||||||
if (attach[plane]) {
|
if (attach[plane]) {
|
||||||
CDWriter cdataw(_cycler, cdata, false);
|
((CData *)cdata.p())->_textures[i]._rtm_mode = RTM_copy_texture;
|
||||||
nassertv(cdata->_textures.size() == cdataw->_textures.size());
|
|
||||||
cdataw->_textures[i]._rtm_mode = RTM_copy_texture;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Assign the texture to this slot.
|
// Assign the texture to this slot.
|
||||||
@ -529,7 +529,7 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta
|
|||||||
GLclampf priority = 1.0f;
|
GLclampf priority = 1.0f;
|
||||||
glPrioritizeTextures(1, >c->_index, &priority);
|
glPrioritizeTextures(1, >c->_index, &priority);
|
||||||
#endif
|
#endif
|
||||||
if (tex->get_texture_type() == Texture::TT_2d_texture) {
|
if (_cube_map_index < 0) {
|
||||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||||
GL_TEXTURE_2D, gtc->_index, 0);
|
GL_TEXTURE_2D, gtc->_index, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -538,7 +538,7 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta
|
|||||||
gtc->_index, 0);
|
gtc->_index, 0);
|
||||||
}
|
}
|
||||||
if (_use_depth_stencil) {
|
if (_use_depth_stencil) {
|
||||||
if (tex->get_texture_type() == Texture::TT_2d_texture) {
|
if (_cube_map_index < 0) {
|
||||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
|
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
|
||||||
GL_TEXTURE_2D, gtc->_index, 0);
|
GL_TEXTURE_2D, gtc->_index, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -568,7 +568,7 @@ bind_slot(bool rb_resize, Texture **attach, RenderTexturePlane slot, GLenum atta
|
|||||||
glPrioritizeTextures(1, >c->_index, &priority);
|
glPrioritizeTextures(1, >c->_index, &priority);
|
||||||
#endif
|
#endif
|
||||||
glgsg->update_texture(tc, true);
|
glgsg->update_texture(tc, true);
|
||||||
if (tex->get_texture_type() == Texture::TT_2d_texture) {
|
if (_cube_map_index < 0) {
|
||||||
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, attachpoint,
|
glgsg->_glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, attachpoint,
|
||||||
GL_TEXTURE_2D, gtc->_index, 0);
|
GL_TEXTURE_2D, gtc->_index, 0);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user