Skip to main content
13 events
when toggle format what by license comment
Oct 25, 2013 at 21:11 history tweeted twitter.com/#!/StackGameDev/status/393847299010723840
Oct 25, 2013 at 21:01 vote accept sm81095
Oct 25, 2013 at 20:20 answer added Sean Middleditch timeline score: 3
Oct 25, 2013 at 20:15 comment added Sean Middleditch @SeanM.: memcpy was not your problem. The prolem is that a std::vector maintains an internal size, and most implementations ensure that any index you access is at least that size. You'd want to do something like data.resize(width * height * depth) to get the right size and then memcpy, or use the std::copy algorithm, or use that with std::back_inserter if you don't wnat to resize first.
Oct 25, 2013 at 20:13 comment added House Please don't update the question with (SOLVED). If you have an answer to the question, it should be posted as an answer.
Oct 25, 2013 at 20:13 comment added Sean Middleditch @NickWiggill: I didn't realize that was the answer; I stopped reading as soon as I got that far and was just giving what I thought was a tangential tip. :)
Oct 25, 2013 at 20:12 history rollback House
Rollback to Revision 1
Oct 25, 2013 at 19:52 history edited sm81095 CC BY-SA 3.0
edited title
Oct 25, 2013 at 19:51 comment added sm81095 I found that memcpy() is not the way to go when copying arrays of glm::vec3's, so I switched it to just copying the values over one index at a time. This seemed to fix the power-of-two rendering errors.
Oct 25, 2013 at 19:20 comment added Engineer @SeanMiddleditch You should really make that an answer.
Oct 25, 2013 at 19:14 comment added sm81095 @SeanMiddleditch, I changed the storage to a 1D array using the z * width * height + y * width + x code provided, initialized by uint16* _blockData = new uint16[REGION_DIM * REGION_DIM * REGION_DIM];. Now I am getting an error if the array doesn't contain at least one value that isn't 0 at the end of the Region constructor, where the array is being initialized. More specifically, this error.
Oct 25, 2013 at 17:38 comment added Sean Middleditch Things like int*** are completely the wrong thing to use here. A "triple pointer" is not logically the same thing as a 3-dimensional array. You can just use a plain std::vector and claculate offsets manually with something like z * width * height + y * width + x (with the total size being width * height * depth of course).
Oct 25, 2013 at 17:03 history asked sm81095 CC BY-SA 3.0