Very frustrating problem
Blitz3D Forums/Blitz3D Beginners Area/Very frustrating problem
| ||
I got the paths right and all but i keep getting an error that the texture doesn't exist. nothing is blocked or hidden i checked and the files are jpg. it works for different textures though EntityTexture earth,eartht path to texture eartht = LoadTexture("Data\Earth\earth.jpg") |
| ||
If the texture wasn't loaded for some reason then the 'eartht' variable will hold a zero. What result do you get for the code below? If the eartht variable is zero or points to a texture that doesn't exist then either the path is wrong, the texture data is incorrect/corrupt, the texture is being freed before you use it, or the eartht variable is being reset to a different value (possibly by a global/local variable scope issue). Graphics 800, 600, 0, 2 eartht = LoadTexture("Data\Earth\earth.jpg") If eartht ; eartht = non-zero RuntimeError "Texture was loaded OK." Else ; eartht = zero RuntimeError "Texture load failed." EndIf |
| ||
As Zethrax explained, First check would be to check if the eartht variable holds a reference after you have loaded the texture (debuglog(eartht)) Second check would be to check if the variable can indeed reach the "scope" where it is used. So in doubt set it to global (until you understand the concept). Third check would be to replace your texture file by another texture file which you know works well (is not corrupt) (you have some jpg in the blitz3d samples). Also you want to have your blitz3d project directory in c:/ because in c:/program files/ Windows Vista 7 8 10 may change the way you can write/read files. |
| ||
Very first steps : 1 - Assert the current directory is the path you're expecting to be ; get currentdir and replace / by \ Local Dir$ = Replace(CurrentDir(),"/","\") ; add a \ at the end if not exists If Right(Dir,1)<>"\" Then Dir = Dir + "\" ; right the currentdir Print CurrentDir() : WaitKey() 2 - Assert the path to the texture exists Print FileType (Dir+"Data\Earth\earth.jpg") : WaitKey() -> if it prints 0, you don't need to go further, you're path is mispelled or you're trying to load a texture that is not on a sub folder of the project If (for some reasons ...) you want to load an external texture to the application folder, you can use the full path ex : LoadTexture (C:\My Texture Folder\Data\Earth\earth.jpg") Then, earth textures can be very large. Depending on where you got it, it's maybe just larger than what your graphics card can support (you might consider 4096*4096 as a limit) |