Updated Image Loading and Displaying Examples (markdown)
parent
b0344b1dc6
commit
5e5072aec7
@ -33,11 +33,6 @@ Once you have an image in GPU texture memory, you can use functions such as `ImG
|
|||||||
**Please note that many new C/C++ users have issues with their files _because the filename they provide is wrong_.**
|
**Please note that many new C/C++ users have issues with their files _because the filename they provide is wrong_.**
|
||||||
|
|
||||||
Two things to watch for:
|
Two things to watch for:
|
||||||
- Make sure your IDE/debugger settings starts your executable from the right working directory. In Visual Studio you can change your working directory in project `Properties > General > Debugging > Working Directory`. People assume that their execution will start from the root folder of the project, where by default it oftens start from the folder where object or executable files are stored.
|
|
||||||
```cpp
|
|
||||||
filename = "MyImage01.jpg"; // Relative filename depends on your Working Directory when running your program!
|
|
||||||
filename = "../MyImage01.jpg"; // Load from parent folder
|
|
||||||
```
|
|
||||||
- In C/C++ and most programming languages if you want to use a backslash `\` within a string literal, you need to write it double backslash `\\`. At it happens, Windows uses backslashes as a path separator, so be mindful.
|
- In C/C++ and most programming languages if you want to use a backslash `\` within a string literal, you need to write it double backslash `\\`. At it happens, Windows uses backslashes as a path separator, so be mindful.
|
||||||
```cpp
|
```cpp
|
||||||
filename = "C:\MyFiles\MyImage01.jpg" // This is INCORRECT!!
|
filename = "C:\MyFiles\MyImage01.jpg" // This is INCORRECT!!
|
||||||
@ -45,6 +40,11 @@ filename = "C:\\MyFiles\\MyImage01.jpg" // This is CORRECT
|
|||||||
```
|
```
|
||||||
In some situations, you may also use `/` path separator under Windows.
|
In some situations, you may also use `/` path separator under Windows.
|
||||||
|
|
||||||
|
- Make sure your IDE/debugger settings starts your executable from the right working directory. In Visual Studio you can change your working directory in project `Properties > General > Debugging > Working Directory`. People assume that their execution will start from the root folder of the project, where by default it oftens start from the folder where object or executable files are stored.
|
||||||
|
```cpp
|
||||||
|
filename = "MyImage01.jpg"; // Relative filename depends on your Working Directory when running your program!
|
||||||
|
filename = "../MyImage01.jpg"; // Load from parent folder
|
||||||
|
```
|
||||||
##### [Return to Index](#index)
|
##### [Return to Index](#index)
|
||||||
|
|
||||||
## About ImTextureId
|
## About ImTextureId
|
||||||
|
Loading…
Reference in New Issue
Block a user