ImGui example now shows Vulkan API and driver info, ImGui+TextOverlay+ConditionalRender+gltfSceneRendering examples now support macOS retina displays

This commit is contained in:
Stephen Saunders 2022-07-12 18:46:39 -04:00
parent bb4281ac24
commit d9d3e8c1fb
5 changed files with 52 additions and 19 deletions

View file

@ -79,12 +79,14 @@ namespace vks
#else
const std::string filename = getAssetPath() + "Roboto-Medium.ttf";
io.Fonts->AddFontFromFileTTF(filename.c_str(), 16.0f * scale);
ImGuiStyle& style = ImGui::GetStyle();
style.ScaleAllSizes(scale);
#endif
io.Fonts->GetTexDataAsRGBA32(&fontData, &texWidth, &texHeight);
VkDeviceSize uploadSize = texWidth*texHeight * 4 * sizeof(char);
//SRS - Set ImGui style scale factor to handle retina and other HiDPI displays (same as font scaling above)
ImGuiStyle& style = ImGui::GetStyle();
style.ScaleAllSizes(scale);
// Create target image for copy
VkImageCreateInfo imageInfo = vks::initializers::imageCreateInfo();
imageInfo.imageType = VK_IMAGE_TYPE_2D;
@ -324,7 +326,6 @@ namespace vks
}
// Index buffer
VkDeviceSize indexSize = imDrawData->TotalIdxCount * sizeof(ImDrawIdx);
if ((indexBuffer.buffer == VK_NULL_HANDLE) || (indexCount < imDrawData->TotalIdxCount)) {
indexBuffer.unmap();
indexBuffer.destroy();