Skip to content

Commit 7e09961

Browse files
authored
Fix stencil attachment for RTT textures and enable depth/stencil for cockpit RTT (scp-fs2open#7386)
1 parent 7590eaa commit 7e09961

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

code/graphics/opengl/gropengltexture.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,9 @@ int opengl_make_render_target( int handle, int *w, int *h, int *bpp, int *mm_lvl
18871887
glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, ts->texture_id, 0, 0);
18881888
}
18891889

1890-
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, new_fbo->renderbuffer_id);
1890+
if (flags & BMP_FLAG_RENDER_TARGET_DEPTH_ATTACHMENT) {
1891+
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, new_fbo->renderbuffer_id);
1892+
}
18911893

18921894
if ( opengl_check_framebuffer() ) {
18931895
// Oops!! reset everything and then bail

code/ship/ship.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8738,7 +8738,7 @@ static void ship_add_cockpit_display(cockpit_display_info *display, int cockpit_
87388738
auto& glow_texture = (*Player_cockpit_textures)[glow_target];
87398739
if ( glow_texture == -1) {
87408740
bm_get_info(diffuse_handle, &w, &h);
8741-
glow_texture = bm_make_render_target(w, h, BMP_FLAG_RENDER_TARGET_DYNAMIC);
8741+
glow_texture = bm_make_render_target(w, h, BMP_FLAG_RENDER_TARGET_DYNAMIC | BMP_FLAG_RENDER_TARGET_DEPTH_ATTACHMENT);
87428742

87438743
// if no render target was made, bail
87448744
if ( glow_texture < 0 ) {

0 commit comments

Comments
 (0)