From dfb973bed0e38af73ddfafef090dd725682ca79e Mon Sep 17 00:00:00 2001 From: xiangsilian Date: Fri, 26 Sep 2025 21:52:54 +0800 Subject: [PATCH] =?UTF-8?q?android=20=E8=AE=BE=E5=A4=87=E4=B8=8A=E8=B7=91?= =?UTF-8?q?=E9=80=9A=E9=80=8F=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/texture_loading/texture_loading.cpp | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/samples/api/texture_loading/texture_loading.cpp b/samples/api/texture_loading/texture_loading.cpp index c8cc4dc..e7e7c6e 100644 --- a/samples/api/texture_loading/texture_loading.cpp +++ b/samples/api/texture_loading/texture_loading.cpp @@ -1,12 +1,12 @@  #include "texture_loading.h" +#include "lodepng.cpp" #ifdef _WIN32 #include #include #include #include - #include "lodepng.cpp" #endif TextureLoading::TextureLoading() @@ -1481,21 +1481,21 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options) size_t dataSize = testImage.size(); processWithVulkan(testImage.data(), width, height, rowStride, dataSize, texture_point); -#ifdef _WIN32 +//#ifdef _WIN32 width = 640; height = 480; rowStride = width * 4; auto arrowImage = generateSimpleTestImage(width, height, 80); dataSize = arrowImage.size(); processWithVulkan(arrowImage.data(), width, height, rowStride, dataSize, cam_text); -#else - - const char* filename = "face.png"; - std::vector image; - unsigned w, h; - unsigned error = lodepng::decode(image, w, h, filename, LCT_RGBA, 8); - processWithVulkan(image.data(), w, h, w*4, image.size(), cam_text); -#endif +//#else +// +// const char* filename = "face.png"; +// std::vector image; +// unsigned w, h; +// unsigned error = lodepng::decode(image, w, h, filename, LCT_RGBA, 8); +// processWithVulkan(image.data(), w, h, w*4, image.size(), cam_text); +//#endif width = 256; height = 256; @@ -1503,8 +1503,13 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options) auto lineImage = generateSimpleTestImage(width, height, 80); dataSize = lineImage.size(); processWithVulkan(lineImage.data(), width, height, rowStride, dataSize, texture_point_line); - +#ifdef _WIN32 const char* filename_test = "assets/test_trans.png"; +#else + const char* filename_test = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/test_trans.png"; +#endif // _WIN32 + + std::vector image_test; unsigned w_t, h_t; unsigned error_t = lodepng::decode(image_test, w_t, h_t, filename_test, LCT_RGBA, 8);