나는 큐브를 그리거나 회전시키는 클래스가 있습니다. 큐브를 회전시킬 때마다 큐브에 대한 새 값으로 버퍼를 다시로드합니다.OutOfMemory 큐브를 그릴 때의 예외
public void LoadBuffer(GraphicsDevice graphicsDevice)
{
buffer = new VertexBuffer(graphicsDevice, VertexPositionNormalTexture.VertexDeclaration, triangles * 3, BufferUsage.None);
buffer.SetData<VertexPositionNormalTexture>(verts);
graphicsDevice.SetVertexBuffer(buffer);
}
public void Draw(GraphicsDevice graphicsDevice)
{
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, triangles);
}
는 몇 분 후 Game.Draw
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(ClearOptions.DepthBuffer | ClearOptions.Target, Color.White, 1f, 0);
basicEffect.Parameters["WorldViewProj"].SetValue(world * view * projection);
EffectPass pass = basicEffect.CurrentTechnique.Passes[0];
if (pass != null)
{
pass.Apply();
cube1.LoadBuffer(GraphicsDevice);
cube1.Draw(GraphicsDevice);
cube2.LoadBuffer(GraphicsDevice);
cube2.Draw(GraphicsDevice);
cube3.LoadBuffer(GraphicsDevice);
cube3.Draw(GraphicsDevice);
}
base.Draw(gameTime);
}
에 Cube.Draw 메소드를 호출하거나 그래서 난 라인 상에 OutOfMemory 예외를 얻을 :
buffer.SetData<VertexPositionNormalTexture>(verts);
수 누군가 이것이 왜 일어나고 있는지 그리고 내가 그것을 해결하기 위해 무엇을 할 수 있는지 설명해주십시오.
안녕 , @ 해리 오버, "BUG"같은 이런 종류의 일을 발견 했습니까? XNA를 선택하기가 너무 슬프다. –
@DuSijun 나는 이것이 작동하도록 만들었지 만 2였다.5 년 전 미안하지만 그것에 대한 자세한 내용을 많이 기억하지 못했습니다. – harryovers