Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fca0a9f

Browse files
committed
Fix "Image Creation"
1 parent 030d57b commit fca0a9f

1 file changed

Lines changed: 0 additions & 16 deletions

File tree

09_Generating_Mipmaps.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,6 @@ The `max` function selects the largest dimension. The `log2` function calculates
3232

3333
To use this value, we need to change the `createImage` and `createImageView` functions to allow us to specify the number of mip levels. Add a `mipLevels` parameter to the functions:
3434

35-
```c++
36-
int texWidth, texHeight, texChannels;
37-
stbi_uc* pixels = stbi_load(TEXTURE_PATH.c_str(), &texWidth, &texHeight, &texChannels, STBI_rgb_alpha);
38-
...
39-
mipLevels = 1;
40-
int32_t mipWidth = texWidth;
41-
int32_t mipHeight = texHeight;
42-
while (mipWidth > 1 && mipHeight > 1) {
43-
mipLevels++;
44-
mipWidth /= 2;
45-
mipHeight /= 2;
46-
}
47-
```
48-
49-
The loop counts the number of mip levels by halving the dimensions of the current mip level, until either dimension is 1. To use this value, we need to change the `createImage` and `createImageView` functions to allow us to specify the number of mip levels. Add a `mipLevels` parameter to the functions:
50-
5135
```c++
5236
void createImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory) {
5337
...

0 commit comments

Comments
 (0)