I think your using the term 'crash' a little loosly here
It's not really crashing - it's throwing an exception to tell you you've done something wrong so you do need to pay attention to the error. It's saying:
Code:
Unhandled exception at 0x76d6b9bc (KernelBase.dll) in WorldCraft.exe: Microsoft C++ exception: std::invalid_argument at memory location 0x003af664..
This means an exception of type invalid_argument has been thrown by PolyVox - i.e. the function argument you passed was not valid. From your next code snippet:
Code:
if(!isPowerOf2(uBlockSideLength))
{
throw std::invalid_argument("Block side length must be a power of two.");
}
This exception can be thrown if your block size is not a power of two (this is why it works for 512). There are other reasons it can be thrown, and you can handle the exception and call the 'what()' function to retrieve the actual error message (this is the same as standard C++ exceptions).
Lastly:
drwbns wrote:
UPDATE: I played around with the num_chunks size and at 512, the program runs but crashes after raycasting with the error -
Code:
Unhandled exception at 0x76d6b9bc (KernelBase.dll) in WorldCraft.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0028e5a0..
This time the exception is of type bad_alloc, which means it failed to allocate enough memory for the block. You should use a much smaller block size (maybe 32 or 64, but still a power of two!).