diff --git a/src/CRE/mdl/draw_object.cpp b/src/CRE/mdl/draw_object.cpp index 6c77c490..998cc539 100644 --- a/src/CRE/mdl/draw_object.cpp +++ b/src/CRE/mdl/draw_object.cpp @@ -487,7 +487,7 @@ namespace mdl { texture* tex = texture_storage_get_texture(::texture_id(0, texture_id)); gl_state_bind_sampler(tex_index, rctx->samplers[(wrap_t * 3 + wrap_s) * 2 - + (tex->max_mipmap_level > 0 ? 1 : 0)]); + + (!tex || tex->max_mipmap_level > 0 ? 1 : 0)]); } } @@ -743,7 +743,7 @@ static void draw_object_material_set_default(render_context* rctx, const mdl::Ob texture* tex = texture_storage_get_texture(::texture_id(0, texture_id)); gl_state_bind_sampler(tex_index, rctx->samplers[(wrap_t * 3 + wrap_s) * 2 - + (tex->max_mipmap_level > 0 ? 1 : 0)]); + + (!tex || tex->max_mipmap_level > 0 ? 1 : 0)]); } if (material->material.shader.index == SHADER_FT_SKY) { @@ -945,7 +945,7 @@ static void draw_object_material_set_reflect(render_context* rctx, const mdl::Ob texture* tex = texture_storage_get_texture(::texture_id(0, texture_id)); gl_state_bind_sampler(i, rctx->samplers[(wrap_t * 3 + wrap_s) * 2 - + (tex->max_mipmap_level > 0 ? 1 : 0)]); + + (!tex || tex->max_mipmap_level > 0 ? 1 : 0)]); } vec4 ambient; diff --git a/src/CRE/render.cpp b/src/CRE/render.cpp index 46e0a615..6566ce24 100644 --- a/src/CRE/render.cpp +++ b/src/CRE/render.cpp @@ -1555,13 +1555,19 @@ namespace rndr { } if (npr_param == 1) { - /*gl_state_active_bind_texture_2d(16, sss_contour_texture->GetColorTex()); - gl_state_bind_sampler(16, rctx->render_samplers[1]); - gl_state_active_bind_texture_2d(17, sss_contour_texture->GetDepthTex()); - gl_state_bind_sampler(17, rctx->render_samplers[1]);*/ gl_state_active_bind_texture_2d(14, rend_texture[0].GetDepthTex()); - gl_state_bind_sampler(14, rctx->render_samplers[1]); + /*gl_state_active_bind_texture_2d(16, sss_contour_texture->GetColorTex()); + gl_state_active_bind_texture_2d(17, sss_contour_texture->GetDepthTex());*/ } + else { + gl_state_active_bind_texture_2d(14, rctx_ptr->empty_texture_2d); + /*gl_state_active_bind_texture_2d(16, rctx_ptr->empty_texture_2d); + gl_state_active_bind_texture_2d(17, srctx_ptr->empty_texture_2d);*/ + } + + gl_state_bind_sampler(14, rctx->render_samplers[1]); + /*gl_state_bind_sampler(16, rctx->render_samplers[1]); + gl_state_bind_sampler(17, rctx->render_samplers[1]);*/ rctx->tone_map_ubo.WriteMemory(shader_data); diff --git a/src/CRE/render_manager.cpp b/src/CRE/render_manager.cpp index 81122a76..23a5879a 100644 --- a/src/CRE/render_manager.cpp +++ b/src/CRE/render_manager.cpp @@ -1081,12 +1081,12 @@ namespace rndr { rctx->contour_params_ubo.WriteMemory(contour_params_data); shaders_ft.set(SHADER_FT_CONTOUR_NPR); - gl_state_active_bind_texture_2d(16, contour_rt->GetColorTex()); - gl_state_bind_sampler(16, rctx->render_samplers[1]); - gl_state_active_bind_texture_2d(17, contour_rt->GetDepthTex()); - gl_state_bind_sampler(17, rctx->render_samplers[1]); gl_state_active_bind_texture_2d(14, rt->GetDepthTex()); + gl_state_active_bind_texture_2d(16, contour_rt->GetColorTex()); + gl_state_active_bind_texture_2d(17, contour_rt->GetDepthTex()); gl_state_bind_sampler(14, rctx->render_samplers[1]); + gl_state_bind_sampler(16, rctx->render_samplers[1]); + gl_state_bind_sampler(17, rctx->render_samplers[1]); rctx->quad_ubo.Bind(0); rctx->contour_params_ubo.Bind(2); gl_state_bind_vertex_array(rctx->common_vao);