Re: Loading assimp
On Wednesday, 29 September 2021 at 02:47:09 UTC, Mike Parker wrote: On Tuesday, 28 September 2021 at 16:30:09 UTC, Eric_DD wrote: I am trying to use a newer version of Assimp. I have found a assimp-vc140-mt.dll (v3.3.1) which I renamed to assimp.dll When running my executable it throws a derelict.util.exception.SharedLibLoadException: "Failed to load one or more shared libraries: assimp.dll - %1 is not a valid Win32 application. Assimp64.dll - The specified module could not be found" Any idea what's going on? Are 64bit dlls not supported? I'm not maintaining the package anymore, but this is an error from the system loader and has nothing to do with the binding itself. It's the sort of error that usually pops up when trying to load a 32-bit DLL into a 64-bit program, or vice versa. Are you sure it's a 64-bit DLL? why my messages are not sent?
Re: Loading assimp
On Tuesday, 28 September 2021 at 20:09:41 UTC, Eric_DD wrote: On Tuesday, 28 September 2021 at 19:59:09 UTC, russhy wrote: On Tuesday, 28 September 2021 at 16:30:09 UTC, Eric_DD wrote: I am trying to use a newer version of Assimp. I have found a assimp-vc140-mt.dll (v3.3.1) which I renamed to assimp.dll When running my executable it throws a derelict.util.exception.SharedLibLoadException: "Failed to load one or more shared libraries: assimp.dll - %1 is not a valid Win32 application. Assimp64.dll - The specified module could not be found" Any idea what's going on? Are 64bit dlls not supported? try to rename it to Assimp64.dll Nah :) Already tried that. It just swaps the file names in the error message. Derelict is kinda old anyways, to make sure we use up to date stuff, try to migrate to bindbc one https://github.com/Sobaya007/bindbc-assimp https://code.dlang.org/packages/bindbc-assimp If i were you i'd compile the project myself, so you know what your DLL is https://github.com/assimp/assimp https://github.com/assimp/assimp/blob/master/Build.md
Re: Loading assimp
On Tuesday, 28 September 2021 at 16:30:09 UTC, Eric_DD wrote: I am trying to use a newer version of Assimp. I have found a assimp-vc140-mt.dll (v3.3.1) which I renamed to assimp.dll When running my executable it throws a derelict.util.exception.SharedLibLoadException: "Failed to load one or more shared libraries: assimp.dll - %1 is not a valid Win32 application. Assimp64.dll - The specified module could not be found" Any idea what's going on? Are 64bit dlls not supported? If using dub you can build your D programs with dub -a x86 for a 32-bit executable dub -a x86_64 for a 64-bit executable (which is also the default thankfully). Your problem is very probably trying to load a 32-bit DLL into a 64 host program.
Re: Loading assimp
On Tuesday, 28 September 2021 at 16:30:09 UTC, Eric_DD wrote: I am trying to use a newer version of Assimp. I have found a assimp-vc140-mt.dll (v3.3.1) which I renamed to assimp.dll When running my executable it throws a derelict.util.exception.SharedLibLoadException: "Failed to load one or more shared libraries: assimp.dll - %1 is not a valid Win32 application. Assimp64.dll - The specified module could not be found" Any idea what's going on? Are 64bit dlls not supported? I'm not maintaining the package anymore, but this is an error from the system loader and has nothing to do with the binding itself. It's the sort of error that usually pops up when trying to load a 32-bit DLL into a 64-bit program, or vice versa. Are you sure it's a 64-bit DLL?
Re: Loading assimp
On Tuesday, 28 September 2021 at 19:59:09 UTC, russhy wrote: On Tuesday, 28 September 2021 at 16:30:09 UTC, Eric_DD wrote: I am trying to use a newer version of Assimp. I have found a assimp-vc140-mt.dll (v3.3.1) which I renamed to assimp.dll When running my executable it throws a derelict.util.exception.SharedLibLoadException: "Failed to load one or more shared libraries: assimp.dll - %1 is not a valid Win32 application. Assimp64.dll - The specified module could not be found" Any idea what's going on? Are 64bit dlls not supported? try to rename it to Assimp64.dll Nah :) Already tried that. It just swaps the file names in the error message.
Re: Loading assimp
On Tuesday, 28 September 2021 at 16:30:09 UTC, Eric_DD wrote: I am trying to use a newer version of Assimp. I have found a assimp-vc140-mt.dll (v3.3.1) which I renamed to assimp.dll When running my executable it throws a derelict.util.exception.SharedLibLoadException: "Failed to load one or more shared libraries: assimp.dll - %1 is not a valid Win32 application. Assimp64.dll - The specified module could not be found" Any idea what's going on? Are 64bit dlls not supported? try to rename it to Assimp64.dll
Re: Loading assimp
I am trying to use a newer version of Assimp. I have found a assimp-vc140-mt.dll (v3.3.1) which I renamed to assimp.dll When running my executable it throws a derelict.util.exception.SharedLibLoadException: "Failed to load one or more shared libraries: assimp.dll - %1 is not a valid Win32 application. Assimp64.dll - The specified module could not be found" Any idea what's going on? Are 64bit dlls not supported?
Re: Loading assimp
On Sunday, 26 March 2017 at 21:52:42 UTC, ag0aep6g wrote: On 03/26/2017 11:31 PM, Dlearner wrote: SDL_Surface* surface = IMG_Load(filename.ptr); if (surface is null) { writeln("surface is null: ", to!string(IMG_GetError())); } else { writeln(filename); } From console: surface is null: Couldn't open Models/Nanosuit/helmet_diff.pngÇ2ÿ I'm assuming the previous textures didn't experience this, but I have no idea what could be the problem here, especially as the filename seems fine when I writeln it. :( How do you construct `filename`? Looks like it's not properly null-terminated. If you followed my (short-sighted) `dup` advice, that doesn't do null-termination. Since the original strings are null-terminated, just slicing one more character should do the trick. I'd put an assert that verifies that the last character is '\0'. I.e.: string z = x.data[0 .. x.length + 1].idup; assert(z[$ - 1] == '\0'); Generally, don't pass just the pointer of a string unless you know for sure that it's properly null-terminated. If you're using a slice directly, without `dup`-ing, then the original aiString would seem to be broken already. Ahh you were absolutely right. I concatenated a '\0' and it worked. Silly me! Most of the textures loaded and a really broken model appears, but I'm guessing that's a result of trying to follow along with a tutorial written for C++ in D. Thank you for your help. I really appreciate it. :)
Re: Loading assimp
On 03/26/2017 11:31 PM, Dlearner wrote: SDL_Surface* surface = IMG_Load(filename.ptr); if (surface is null) { writeln("surface is null: ", to!string(IMG_GetError())); } else { writeln(filename); } From console: surface is null: Couldn't open Models/Nanosuit/helmet_diff.pngÇ2ÿ I'm assuming the previous textures didn't experience this, but I have no idea what could be the problem here, especially as the filename seems fine when I writeln it. :( How do you construct `filename`? Looks like it's not properly null-terminated. If you followed my (short-sighted) `dup` advice, that doesn't do null-termination. Since the original strings are null-terminated, just slicing one more character should do the trick. I'd put an assert that verifies that the last character is '\0'. I.e.: string z = x.data[0 .. x.length + 1].idup; assert(z[$ - 1] == '\0'); Generally, don't pass just the pointer of a string unless you know for sure that it's properly null-terminated. If you're using a slice directly, without `dup`-ing, then the original aiString would seem to be broken already.
Re: Loading assimp
On Sunday, 26 March 2017 at 12:40:42 UTC, Dlearner wrote: ... About half the textures seem to load fine. Some progress! I don't know why, but when I get to the 8th texture, the filename has some garbage attached. SDL_Surface* surface = IMG_Load(filename.ptr); if (surface is null) { writeln("surface is null: ", to!string(IMG_GetError())); } else { writeln(filename); } From console: surface is null: Couldn't open Models/Nanosuit/helmet_diff.pngÇ2ÿ I'm assuming the previous textures didn't experience this, but I have no idea what could be the problem here, especially as the filename seems fine when I writeln it. :(
Re: Loading assimp
On Sunday, 26 March 2017 at 11:10:55 UTC, ag0aep6g wrote: On Sunday, 26 March 2017 at 10:34:21 UTC, Dlearner wrote: I came back to this project and realised my mistakes (Importer is a class for the C++ API, and we're using the C API). So I fixed all my errors, but now I get an access violation. As far as I can tell, it seems to be an issue with `aiGetMaterialTexture`. It is meant to return an aiString with a filename (default value of "$texture.png"), I believe. But I get: aiString(13, x"67 6C 61 73 73 5F 64 69 66 2E 70 6E 67 00 FF FF FF ... FF"c) [shortened for brevity] The data is "glass_dif.png", followed by a null terminator, followed by a bunch of 0xFFs. 13 is the length of "glass_dif.png". Judging from the definition of aiString [1], the 0xFFs are just unused space. So, this looks good. I'm meant to add this on to a directory string so I can load an image, but obviously this wouldn't work. To convert an aiString to a D string, it should be possible to slice the data with the length: aiString x; const(char)[] y = x.data[0 .. x.length]; You have to be cautiots of lifetime requirements, of course. If needed, you can make a copy with dup (mutable copy) or idup (immutable copy): const(char)[] y = x.data[0 .. x.length].dup; string z = x.data[0 .. x.length].idup; [1] http://www.assimp.org/lib_html/structai_string.html Ahh this did help! I practically followed your advice, then fixed a somewhat unrelated range violation, and got a similar "object.Error@(0): Access Violation". But in the console I got: filename: Models/Nanosuit/glass_dif.png filename: Models/Nanosuit/leg_dif.png filename: Models/Nanosuit/leg_showroom_spec.png filename: Models/Nanosuit/hand_dif.png filename: Models/Nanosuit/hand_showroom_spec.png filename: Models/Nanosuit/arm_dif.png filename: Models/Nanosuit/arm_showroom_spec.png filename: Models/Nanosuit/helmet_diff.png About half the textures seem to load fine. Some progress!
Re: Loading assimp
On Sunday, 26 March 2017 at 10:34:21 UTC, Dlearner wrote: I came back to this project and realised my mistakes (Importer is a class for the C++ API, and we're using the C API). So I fixed all my errors, but now I get an access violation. As far as I can tell, it seems to be an issue with `aiGetMaterialTexture`. It is meant to return an aiString with a filename (default value of "$texture.png"), I believe. But I get: aiString(13, x"67 6C 61 73 73 5F 64 69 66 2E 70 6E 67 00 FF FF FF ... FF"c) [shortened for brevity] The data is "glass_dif.png", followed by a null terminator, followed by a bunch of 0xFFs. 13 is the length of "glass_dif.png". Judging from the definition of aiString [1], the 0xFFs are just unused space. So, this looks good. I'm meant to add this on to a directory string so I can load an image, but obviously this wouldn't work. To convert an aiString to a D string, it should be possible to slice the data with the length: aiString x; const(char)[] y = x.data[0 .. x.length]; You have to be cautiots of lifetime requirements, of course. If needed, you can make a copy with dup (mutable copy) or idup (immutable copy): const(char)[] y = x.data[0 .. x.length].dup; string z = x.data[0 .. x.length].idup; [1] http://www.assimp.org/lib_html/structai_string.html
Re: Loading assimp
I came back to this project and realised my mistakes (Importer is a class for the C++ API, and we're using the C API). So I fixed all my errors, but now I get an access violation. As far as I can tell, it seems to be an issue with `aiGetMaterialTexture`. It is meant to return an aiString with a filename (default value of "$texture.png"), I believe. But I get: aiString(13, x"67 6C 61 73 73 5F 64 69 66 2E 70 6E 67 00 FF FF FF ... FF"c) [shortened for brevity] I'm meant to add this on to a directory string so I can load an image, but obviously this wouldn't work. I thought it might be a problem with converting from D-strings to C-strings. I sent a string to `aiImportFile` as `toStringz(path)`. I tested this with some writeln debugging: ``` auto temp = path.toStringz; writeln("toStringz: ", temp); writeln("string: ", temp.to!string); ``` This gave: toStringz: 4770B6 string: Models/Nanosuit/nanosuit.obj So maybe this is a problem with using aiStrings? I'm quite confused. Sorry if this is more of an assimp question than a D question, but I don't know if it's me misusing D language features or not.
Re: Loading assimp
Need to rez this thread because I ran into a wall. Two little things: 1) Can't seem to get the Importer class to work ("undefined identifier 'Importer' ", etc), and 2) GetTexture and GetTextureCount for aiMaterial don't seem to work (source\model.d(105,28): Error: no property 'GetTextureCount' for type 'aiMaterial*' source\model.d(107,6): Error: no property 'GetTexture' for type 'aiMaterial*') There are some const issues, too, but I can hack around them. Does anyone have any experience with these?
Re: Loading assimp
On Tuesday, 10 January 2017 at 00:10:12 UTC, Mike Parker wrote: On Monday, 9 January 2017 at 18:13:03 UTC, Dlearner wrote: I'm trying to use assimp to load models in a program. I see the Derelict binding is for version 3.3, but the assimp site has no binaries for this, just source. So I try to use version 3.1.1 and I get this error: derelict.util.exception.SymbolLoadException@..\..\AppData\Roaming\dub\packages\derelict-util-2.0.6\derelict-util\source\derelict\util\exception.d(35): Failed to load symbol aiReleaseExportFormatDescription from shared library assimp.dll Use version 1.1.1 of DerelictASSIMP3. It's implemented against ASSIMP 3.1. A-haa, thank you!
Re: Loading assimp
On Monday, 9 January 2017 at 18:13:03 UTC, Dlearner wrote: I'm trying to use assimp to load models in a program. I see the Derelict binding is for version 3.3, but the assimp site has no binaries for this, just source. So I try to use version 3.1.1 and I get this error: derelict.util.exception.SymbolLoadException@..\..\AppData\Roaming\dub\packages\derelict-util-2.0.6\derelict-util\source\derelict\util\exception.d(35): Failed to load symbol aiReleaseExportFormatDescription from shared library assimp.dll Use version 1.1.1 of DerelictASSIMP3. It's implemented against ASSIMP 3.1.
Loading assimp
I'm trying to use assimp to load models in a program. I see the Derelict binding is for version 3.3, but the assimp site has no binaries for this, just source. So I try to use version 3.1.1 and I get this error: derelict.util.exception.SymbolLoadException@..\..\AppData\Roaming\dub\packages\derelict-util-2.0.6\derelict-util\source\derelict\util\exception.d(35): Failed to load symbol aiReleaseExportFormatDescription from shared library assimp.dll Is this a version problem that I need 3.3 for? If so, I don't know how to build the .dll since I'm still new to programming. Please send help! :)