Thanks for that tip, in a minimal example, rendering nothing, it just having a blank window open and refreshing it, it uses 40MB. So the memory of my program is about 20mb, i guess.
It thinks this is the function with the most allocated memory in the minimal example:
Functions Allocating Most Memory
Name Bytes %
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(native int,int32,int32) 43.04
I'm not really sure what that is, lol.
Anyway, in relation to the earlier posts of this thread, I tried using a Vertex[] instead of VertexArray. I can get it to render just fine when I use the new function to create the new vertex to display, however, if I don't use the new function, it just doesn't work for some reason.
In the code below, the first set of code succeeding the commented section works, the next part doesn't work. In the second part I used the new function to create the Vector2f, so in the third example I got rid of the new function all together just to rule out that as a cause.
//WORKS
testVertexArray[index + 0] = new Vertex(new Vector2f(i * tileSize.X, j * tileSize.Y), new Vector2f(tu * tileSize.X, tv * tileSize.Y));
testVertexArray[index + 1] = new Vertex(new Vector2f((i + 1) * tileSize.X, j * tileSize.Y), new Vector2f((tu + 1) * tileSize.X, tv * tileSize.Y));
testVertexArray[index + 2] = new Vertex(new Vector2f((i + 1) * tileSize.X, (j + 1) * tileSize.Y), new Vector2f((tu + 1) * tileSize.X, (tv + 1) * tileSize.Y));
testVertexArray[index + 3] = new Vertex(new Vector2f(i * tileSize.X, (j + 1) * tileSize.Y), new Vector2f(tu * tileSize.X, (tv + 1) * tileSize.Y));
//DOESNT WORK
testVertexArray[index + 0].Position.X = i * tileSize.X;
testVertexArray[index + 0].Position.Y = j * tileSize.Y;
testVertexArray[index + 1].Position.X = (i + 1) * tileSize.X;
testVertexArray[index + 1].Position.Y = j * tileSize.Y;
testVertexArray[index + 2].Position.X = (i + 1) * tileSize.X;
testVertexArray[index + 2].Position.Y = (j + 1) * tileSize.Y;
testVertexArray[index + 3].Position.X = i * tileSize.X;
testVertexArray[index + 3].Position.Y = (j + 1) * tileSize.Y;
testVertexArray[index + 0].TexCoords.X = tu * tileSize.X;
testVertexArray[index + 0].TexCoords.Y = tv * tileSize.Y;
testVertexArray[index + 1].TexCoords.X = (tu + 1) * tileSize.X;
testVertexArray[index + 1].TexCoords.Y = tv * tileSize.Y;
testVertexArray[index + 2].TexCoords.X = (tu + 1) * tileSize.X;
testVertexArray[index + 2].TexCoords.Y = (tv + 1) * tileSize.Y;
testVertexArray[index + 3].TexCoords.X =tu * tileSize.X;
testVertexArray[index + 3].TexCoords.Y = (tv + 1) * tileSize.Y;
//DOESNT WORK
testVertexArray[index + 0].Position = new Vector2f(i * tileSize.X, j * tileSize.Y);
testVertexArray[index + 1].Position = new Vector2f((i + 1) * tileSize.X, j * tileSize.Y);
testVertexArray[index + 2].Position = new Vector2f((i + 1) * tileSize.X, (j + 1) * tileSize.Y);
testVertexArray[index + 3].Position = new Vector2f(i * tileSize.X, (j + 1) * tileSize.Y);
testVertexArray[index + 0].TexCoords = new Vector2f(tu * tileSize.X, tv * tileSize.Y);
testVertexArray[index + 1].TexCoords = new Vector2f((tu + 1) * tileSize.X, tv * tileSize.Y);
testVertexArray[index + 2].TexCoords = new Vector2f((tu + 1) * tileSize.X, (tv + 1) * tileSize.Y);
testVertexArray[index + 3].TexCoords = new Vector2f(tu * tileSize.X, (tv + 1) * tileSize.Y);
Sorry that it's quite lengthy, but it's essentially all the same thing, just rewritten. I'm not sure why this isn't working. Do you have any idea?
Thanks!