Date: 08/31/06 (C Sharp) Keywords: no keywords Okay, I know I'm missing something blissfully obvious, but that is my lot in life. ib = new IndexBuffer(typeof(short), (WIDTH - 1) * (HEIGHT - 1) * 6, device, Usage.WriteOnly, Pool.Default); indices = new short[(WIDTH - 1) * (HEIGHT - 1) * 6]; for (int x = 0; x < WIDTH - 1; x++) { for (int y = 0; y < HEIGHT - 1; y++) { indices[(x + y * (WIDTH - 1)) * 6] = (short)((x + 1) + (y + 1) * WIDTH); indices[(x + y * (WIDTH - 1)) * 6 + 1] = (short)((x + 1) + y * WIDTH); indices[(x + y * (WIDTH - 1)) * 6 + 2] = (short)(x + y * WIDTH); indices[(x + y * (WIDTH - 1)) * 6 + 3] = (short)((x + 1) + (y + 1) * WIDTH); indices[(x + y * (WIDTH - 1)) * 6 + 4] = (short)(x + y * WIDTH); indices[(x + y * (WIDTH - 1)) * 6 + 5] = (short)(x + (y + 1) * WIDTH); } } On the second iteration through, on the first line in the FOR block, I get this error: "Make sure that the maximum index on a list is less than the list size." I've stared at it until I'm blue in the face, and can't see where the index would be larger. (WIDTH is hardcoded to 4 and HEIGHT to 3 in the variable declaration block.) Especially when x=0 and y=1. Ideas? Thankee much. (This is using VS 2005 standard, by the by. I'm using SHORTs instead of INTs thanks to an old vidcard that doesn't support INT-size index buffers. grumble.)
|