diff --git a/src/DivaGL/mdl/draw_object.cpp b/src/DivaGL/mdl/draw_object.cpp index 3abfca5..26e2b36 100644 --- a/src/DivaGL/mdl/draw_object.cpp +++ b/src/DivaGL/mdl/draw_object.cpp @@ -467,7 +467,7 @@ namespace mdl { texture* tex = texture_handler_get_texture(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)]); } } @@ -723,7 +723,7 @@ static void draw_object_material_set_default(const mdl::ObjSubMeshArgs* args, bo texture* tex = texture_handler_get_texture(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) { @@ -925,7 +925,7 @@ static void draw_object_material_set_reflect(const mdl::ObjSubMeshArgs* args) { texture* tex = texture_handler_get_texture(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/DivaGL/render.cpp b/src/DivaGL/render.cpp index 6d9027b..879da6b 100644 --- a/src/DivaGL/render.cpp +++ b/src/DivaGL/render.cpp @@ -1298,13 +1298,19 @@ namespace rndr { } if (render_manager->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->empty_texture_2d); + /*gl_state_active_bind_texture_2d(16, rctx->empty_texture_2d); + gl_state_active_bind_texture_2d(17, rctx->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/DivaGL/render_manager.cpp b/src/DivaGL/render_manager.cpp index d446b74..00752e9 100644 --- a/src/DivaGL/render_manager.cpp +++ b/src/DivaGL/render_manager.cpp @@ -951,12 +951,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);