Creating VertexDeclaration every frame

Hi @ll

i have a simple quiestion bout examples in xna tutorials

why VertexDeclaration is creating every frame

using( VertexDeclaration decl = new VertexDeclaration(
graphics.GraphicsDevice, VertexPositionColor.VertexElements ) )
{....

Why instead of it just create it once on start and use then every frame?

[347 byte] By [NeTBaPb] at [2007-12-25]
# 1
This is a bug. You shouldn't create a VertexDeclaration each frame. We've fixed this in Spacewar, if that's what you were referring to. Or are you seeing this elsewhere in the docs?
MitchWalker-MSFT at 2007-10-8 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 2

it seems this is the only place in docs with this bug

Mitch Walker - MSFT wrote:
This is a bug. You shouldn't create a VertexDeclaration each frame.

that's what i want to hear, thx for quick reply :)

btw, i've tried to use BasicEffect, but seems it's bugged, no vertex color, no lighting (there r light artifacts; edit: ohh, i forgot to define vertex normals ^_^) or maybe i'm doing something wrong :)

NeTBaPb at 2007-10-8 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 3
The version of BasicEffect we shipped in the beta doesn't support vertex color, but we're hoping to add that for the final release.
Lighting works fine with BasicEffect as long as you have normals in your geometry data.
ShawnHargreaves at 2007-10-8 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...