public void Dispose() { if (VertexBuffer != null && !VertexBuffer.Disposed) { VertexBuffer.Dispose(); } if (VertexInputLayout != null && !VertexInputLayout.Disposed) { VertexInputLayout.Dispose(); } if (SpriteEffect != null && !SpriteEffect.Disposed) { SpriteEffect.Dispose(); } if (SpriteTexture != null && !SpriteTexture.Disposed) { SpriteTexture.Dispose(); } if (mapedBitmap != null) { mapedBitmap.Dispose(); } if (mapedGraphic != null) { mapedGraphic.Dispose(); } }
public void DifferentVboGetsSet() { var vb1 = new VertexBuffer(gd, VertexPosition.VertexDeclaration, 6, BufferUsage.None); var vb2 = new VertexBuffer(gd, VertexPosition.VertexDeclaration, 8, BufferUsage.None); var se = new SpriteEffect(gd); se.CurrentTechnique.Passes[0].Apply(); gd.SetVertexBuffer(vb1); gd.DrawPrimitives(PrimitiveType.TriangleList, 0, 2); int vbo; GL.GetInteger(GetPName.ArrayBufferBinding, out vbo); Assert.AreEqual(vb1.vbo, vbo); gd.SetVertexBuffer(vb2); gd.DrawPrimitives(PrimitiveType.TriangleList, 0, 2); GL.GetInteger(GetPName.ArrayBufferBinding, out vbo); Assert.AreEqual(vb2.vbo, vbo); se.Dispose(); vb1.Dispose(); vb2.Dispose(); }
public void Dispose() { if (BatchDisposing != null) { BatchDisposing(this, new EventArgs()); } if (TextureD3D10 != null && !TextureD3D10.Disposed) { TextureD3D10.Dispose(); } if (TextureD3D11 != null && !TextureD3D11.Disposed) { TextureD3D11.Dispose(); } if (MutexD3D10 != null && !MutexD3D10.Disposed) { MutexD3D10.Dispose(); } if (MutexD3D11 != null && !MutexD3D11.Disposed) { MutexD3D11.Dispose(); } if (DWRenderTarget != null && !DWRenderTarget.Disposed) { DWRenderTarget.Dispose(); } if (VertexBuffer != null && !VertexBuffer.Disposed) { VertexBuffer.Dispose(); } if (VertexInputLayout != null && !VertexInputLayout.Disposed) { VertexInputLayout.Dispose(); } if (SpriteEffect != null && !SpriteEffect.Disposed) { SpriteEffect.Dispose(); } if (sampler != null && !sampler.Disposed) { sampler.Dispose(); } //以下の二つはRenderContextがDisposeされるときに呼ばれないとバグが出る。(画面真っ黒) //これは同じ種類のブレンドステートがDisposeされてしまうからだと予測できる。 //このため、Dispose予定リストに含めておき、RenderContextの破棄時に処理をする context.Disposables.Add(TransParentBlendState); context.Disposables.Add(state); }
/// <summary> /// /// </summary> public void Dispose() { _scissorTestEnabled.Dispose(); _defaultEffect.Dispose(); _spriteEffect.Dispose(); }