diff --git a/samples/api/texture_loading/texture_loading.cpp b/samples/api/texture_loading/texture_loading.cpp index 9abe28c..fdcc76c 100644 --- a/samples/api/texture_loading/texture_loading.cpp +++ b/samples/api/texture_loading/texture_loading.cpp @@ -902,17 +902,26 @@ void TextureLoading::prepare_uniform_buffers_point() VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VMA_MEMORY_USAGE_CPU_TO_GPU); - update_uniform_buffers_point(60, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 2); + update_uniform_buffers_point(60, -0.5, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 2); } void global_update_mvp(float fov, float x, float y, float z, float sx, float sy, float sz, float rotx, float roty, float rotz, float camx, float camy, float camz) { - TextureLoading::Get()->update_uniform_buffers_point(fov, x, y, z, sx, sy, sz, rotx, roty, rotz, camx, camy, camz); + TextureLoading* self = TextureLoading::Get(); + if (self != nullptr) + { + self->update_uniform_buffers_point(fov, x, y, z, sx, sy, sz, rotx, roty, rotz, camx, camy, camz); + } } void TextureLoading::update_uniform_buffers_point(float fov, float x, float y, float z, float sx, float sy, float sz, float rotx, float roty, float rotz, float camx, float camy, float camz) { + if (!prepared) + { + return; + } + std::unique_lock lock(mtx_mvp); ubo_vs_point.projection = glm::perspective(glm::radians(fov), static_cast(width) / static_cast(height), 0.001f, 256.0f);