   Point Sprites
  So I ported over some C# code to make point sprites and now I have run into some problems.  Currently, there isn't anything being drawn to the screen and I think the problem lies somewhere in my DirectX render states.  I have been searching all over for point sprite examples to figure out what I am doing wrong so there are probably some extra render states shoved into my code. If anyone would be kind enough to look through my source, that would be awesome.EffectManager.h#ifndef EFFECTMANAGER_H_#define EFFECTMANAGER_H_#include <string>#include <map>using std::string;using std::map;#include "Color.h"#include "Effect.h"using Engine::Draw::Color;using Engine::Content::Effect;#include "Vector3.h"using Math::Vector3;#include "GameInfo.h"#include "RenderDataController.h"#include "ParticleRetriever.h"typedef class _ParticleRetriever *ParticleRetriever;struct ParticleVertex{    // Stores the starting position of the particle.    Vector3 Position;    // Stores the starting velocity of the particle.    Vector3 Velocity;    // Four random values, used to make each particle look slightly different.    Color Random;    // The time (in seconds) at which this particle was created.    float Time;};struct ParticleSettings{ParticleSettings();    // Name of the texture used by this particle system.    string TextureName;    // Maximum number of particles that can be displayed at one time.    int MaxParticles;    // How long these particles will last.    float Duration;    // If greater than zero, some particles will last a shorter time than others.    float DurationRandomness;    // Controls how much particles are influenced by the velocity of the object    // which created them. You can see this in action with the explosion effect,    // where the flames continue to move in the same direction as the source    // projectile. The projectile trail particles, on the other hand, set this    // value very low so they are less affected by the velocity of the projectile.    float EmitterVelocitySensitivity;    // Range of values controlling how much X and Z axis velocity to give each    // particle. Values for individual particles are randomly chosen from somewhere    // between these limits.    float MinHorizontalVelocity;    float MaxHorizontalVelocity;    // Range of values controlling how much Y axis velocity to give each particle.    // Values for individual particles are randomly chosen from somewhere between    // these limits.    float MinVerticalVelocity;    float MaxVerticalVelocity;    // Direction and strength of the gravity effect. Note that this can point in any    // direction, not just down! The fire effect points it upward to make the flames    // rise, and the smoke plume points it sideways to simulate wind.    Vector3 Gravity;    // Controls how the particle velocity will change over their lifetime. If set    // to 1, particles will keep going at the same speed as when they were created.    // If set to 0, particles will come to a complete stop right before they die.    // Values greater than 1 make the particles speed up over time.    float EndVelocity;    // Range of values controlling the particle color and alpha. Values for    // individual particles are randomly chosen from somewhere between these limits.    Color MinColor;    Color MaxColor;    // Range of values controlling how fast the particles rotate. Values for    // individual particles are randomly chosen from somewhere between these    // limits. If both these values are set to 0, the particle system will    // automatically switch to an alternative shader technique that does not    // support rotation, and thus requires significantly less GPU power. This    // means if you don't need the rotation effect, you may get a performance    // boost from leaving these values at 0.    float MinRotateSpeed;    float MaxRotateSpeed;    // Range of values controlling how big the particles are when first created.    // Values for individual particles are randomly chosen from somewhere between    // these limits.    float MinStartSize;    float MaxStartSize;    // Range of values controlling how big particles become at the end of their    // life. Values for individual particles are randomly chosen from somewhere    // between these limits.    float MinEndSize;    float MaxEndSize;};//! A class used for each type of particle effectclass ParticleSystem{public:ParticleSystem();void AddParticle(Vector3 position, Vector3 velocity);void Initialize(GameInfo* gameInfo, RenderDataController* renderDataController, ParticleSettings &settings);void Render(GameInfo* gameInfo);void ScaleFactor(float scale);~ParticleSystem();protected:static float scaleFactor;private:void RetireActiveParticles();void FreeRetiredParticles();void AddNewParticlesToVertexBuffer();ParticleSettings settings;// Shortcuts for accessing frequently changed effect parameters.    EffectParameter effectViewParameter;    EffectParameter effectProjectionParameter;    EffectParameter effectViewportHeightParameter;    EffectParameter effectTimeParameter;// Copied over to the vertex bufferParticleVertex *particles;LPDIRECT3DVERTEXBUFFER9 vertexBuffer;int firstActiveParticle;    int firstNewParticle;    int firstFreeParticle;    int firstRetiredParticle;    float currentTime;    unsigned int drawCounter;Effect effect;Texture2D texture;bool textureSet;// Keep this pointer around to clone if the effect isn't initialized quick enoughEffect cloneableEffect;// Has the effect been cloned?bool cloned;// View, Projection, EyePositionRenderDataController* renderController;};class EffectManager{public:static void Initialize(GameInfo *gameInfo, RenderDataController* renderDataController, string xmlFile);static void Render(GameInfo *gameInfo);static void Release();static ParticleRetriever RetrieveSystem(string systemName);~EffectManager();private:static EffectManager *Manager;// Map to all the initialized systems.std::map<string,ParticleSystem*> systemMap;// Collection of all retrieversstd::map<string,ParticleRetriever> retrieverMap;EffectManager();RenderDataController* renderData;IDirect3DVertexDeclaration9 *decl;};#endifEffectManager.cpp#include <time.h>#define RandomFloat ((float)rand() / ((float)(RAND_MAX)+(float)(1)))#include "EffectManager.h"EffectManager* EffectManager::Manager = NULL;float ParticleSystem::scaleFactor = 1;EffectManager::EffectManager(){decl = NULL;}inline DWORD FtoDW( FLOAT f ) { return *((DWORD*)&f); }void EffectManager::Initialize(GameInfo *gameInfo, RenderDataController* renderDataController, string xmlFile){if(Manager == NULL)Manager = new EffectManager;Manager->renderData = renderDataController;srand((unsigned)time(0)); if(Manager->decl == NULL){D3DVERTEXELEMENT9 ParticleVertDecl[] ={{0,  0,D3DDECLTYPE_FLOAT3,D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},{0, 12,D3DDECLTYPE_FLOAT3,D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0}, // Offset by 12 bytes 3*sizof(float){0, 24,D3DDECLTYPE_UBYTE4,D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, // Offset by 12 bytes 3*sizof(float){0, 28,D3DDECLTYPE_FLOAT1,D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,0},D3DDECL_END()};gameInfo->Graphics->GetGraphicsDevice()->CreateVertexDeclaration(ParticleVertDecl,&Manager->decl);}// Load in the particle effect used in cloning in each ParticleSystemgameInfo->Content->Load("Particle Effect", "Content/Effects/ParticleEffect.fx");//gameInfo->Content->Get("Particle Effect",&Manager->mainEffect);//gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_POINTSIZE,256);// Read in xml and make particle systems hereParticleSystem *system = new ParticleSystem();ParticleSettings settings;settings.TextureName = "Content/Textures/4.png";system->Initialize(gameInfo,renderDataController,settings);Manager->systemMap["TEST"] = system;}void EffectManager::Render(GameInfo *gameInfo){if(Manager == NULL)return;gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_POINTSPRITEENABLE,TRUE);gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_POINTSCALEENABLE,TRUE);gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_POINTSIZE_MAX, FtoDW(256.0) ); // Float value that specifies the size to use for point size computation in cases where point size is not specified for each vertex.gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_POINTSIZE_MIN, FtoDW(100.0f) );    // Float value that specifies the minimum size of point primitives. Point primitives are clamped to this size during rendering.gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_POINTSCALE_A,  FtoDW(1.0f) );    // Default 1.0    gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_POINTSCALE_B,  FtoDW(1.0f) );    // Default 0.0    gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_POINTSCALE_C,  FtoDW(1.0) );    // Default 0.0gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE );   // gameInfo->Graphics->GetGraphicsDevice()->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );gameInfo->Graphics->GetGraphicsDevice()->SetVertexDeclaration(Manager->decl);// Iterate and draw all the particle systemsmap<string,ParticleSystem*>::iterator iter = Manager->systemMap.begin();while(iter!=Manager->systemMap.end()){iter->second->Render(gameInfo);iter++;}gameInfo->Graphics->ResetVertexType();gameInfo->Graphics->GetGraphicsDevice()->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_POINTSPRITEENABLE,FALSE);//gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_POINTSCALEENABLE,FALSE);gameInfo->Graphics->GetGraphicsDevice()->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);}ParticleRetriever EffectManager::RetrieveSystem(std::string systemName){map<string,ParticleSystem*>::iterator iter = Manager->systemMap.find(systemName);if(iter == Manager->systemMap.end())return NULL;else{map<string,ParticleRetriever>::iterator ret = Manager->retrieverMap.find(systemName);if(ret == Manager->retrieverMap.end()){ParticleRetriever newRetriever = new _ParticleRetriever();newRetriever->Initialize(iter->second);Manager->retrieverMap[systemName] = newRetriever;return newRetriever;}elsereturn ret->second;}}ParticleSettings::ParticleSettings(){MaxParticles = 100;Duration = 100;DurationRandomness = 0;EmitterVelocitySensitivity = 1;MinHorizontalVelocity = 0;MaxHorizontalVelocity = 0;MinVerticalVelocity = 0;MaxVerticalVelocity = 0;EndVelocity = 1;Gravity = Vector3::Zero();MinColor = Color::White();MaxColor = Color::White();MinRotateSpeed = 0;MaxRotateSpeed = 0;MinStartSize = 100;MaxStartSize = 100;MinEndSize = 100;MaxEndSize = 100;}ParticleSystem::ParticleSystem(){cloned = false;}void ParticleSystem::Initialize(GameInfo *gameInfo, RenderDataController* renderDataController, ParticleSettings &settings){renderController = renderDataController;this->settings = settings;particles = new ParticleVertex[settings.MaxParticles];firstActiveParticle = 0;    firstNewParticle = 0;    firstFreeParticle = 0;    firstRetiredParticle = 0;    currentTime = 0;    drawCounter = 0;this->effect = NULL;gameInfo->Graphics->GetGraphicsDevice()->CreateVertexBuffer(sizeof(ParticleVertex)*settings.MaxParticles,D3DUSAGE_POINTS | D3DUSAGE_WRITEONLY,0,D3DPOOL_MANAGED,&vertexBuffer,0);void* pVoid;vertexBuffer->Lock(0,0,&pVoid,0);memcpy(pVoid,particles,settings.MaxParticles*sizeof(ParticleVertex));vertexBuffer->Unlock();gameInfo->Content->Get("Particle Effect",&cloneableEffect);string id = settings.TextureName.substr(0,settings.TextureName.find_last_of("."));gameInfo->Content->Load(id,settings.TextureName);gameInfo->Content->Get(id,&texture);textureSet = false;}void ParticleSystem::Render(GameInfo *gameInfo){if(cloneableEffect != NULL && !cloned){effect = cloneableEffect;//gameInfo->Graphics->CloneEffect(cloneableEffect);if(effect!=NULL){// These settings changeeffectProjectionParameter.Initialize("Projection",effect);effectTimeParameter.Initialize("CurrentTime",effect);effectViewParameter.Initialize("View",effect);effectViewportHeightParameter.Initialize("ViewportHeight",effect);// These settings do not change.effect->Parameter["Duration"].Set(settings.Duration);  effect->Parameter["DurationRandomness"].Set(settings.DurationRandomness);  effect->Parameter["Gravity"].Set(settings.Gravity);  effect->Parameter["EndVelocity"].Set(settings.EndVelocity);  effect->Parameter["MinColor"].Set(settings.MinColor);  effect->Parameter["MaxColor"].Set(settings.MaxColor);  effect->Parameter["RotateSpeed"].Set((float*)&Vector3(settings.MinRotateSpeed, settings.MaxRotateSpeed,0),2);    effect->Parameter["StartSize"].Set((float*)&Vector3(settings.MinStartSize, settings.MaxStartSize,0),2);    effect->Parameter["EndSize"].Set((float*)&Vector3(settings.MinEndSize , settings.MaxEndSize ,0),2);  // Choose the appropriate effect technique. If these particles will never  // rotate, we can use a simpler pixel shader that requires less GPU power.  string techniqueName;  if ((settings.MinRotateSpeed == 0) && (settings.MaxRotateSpeed == 0)) techniqueName = "NonRotatingParticles";  else techniqueName = "RotatingParticles";effect->SetTechnique(techniqueName);cloned = true;}elsereturn;}if(!textureSet && cloned && texture != NULL){   effect->Parameter["Texture"].Set(texture);textureSet = true;}// Set the standard variablesif(effect!=NULL){effectProjectionParameter.Set(*renderController->Projection());effectTimeParameter.Set(gameInfo->Time->TotalRealTime());effectViewParameter.Set(*renderController->Projection());effectViewportHeightParameter.Set(gameInfo->Graphics->Height());}currentTime += (float)gameInfo->Time->ElapsedTime();// Clean up and "remove" any expired particles.RetireActiveParticles();FreeRetiredParticles();if (firstActiveParticle == firstFreeParticle) currentTime = 0;    if (firstRetiredParticle == firstActiveParticle)   drawCounter = 0;if (firstNewParticle != firstFreeParticle)    {   AddNewParticlesToVertexBuffer();    }// If there are any active particles, draw them now!    if (cloned && firstActiveParticle != firstFreeParticle)    {   // Set an effect parameter describing the viewport size. This is needed   // to convert particle sizes into screen space point sprite sizes.effectViewportHeightParameter.Set(gameInfo->Graphics->Height());   // Set an effect parameter describing the current time. All the vertex   // shader particle animation is keyed off this value.   effectTimeParameter.Set(currentTime);   // Set the particle vertex buffer and vertex declaration.gameInfo->Graphics->GetGraphicsDevice()->SetStreamSource(0,vertexBuffer,0,sizeof(ParticleVertex));unsigned int passes;   // Activate the particle effect.effect->Begin(passes);   for (unsigned int i = 0; i < passes; i++)   {  effect->BeginPass(i);  if (firstActiveParticle < firstFreeParticle)  { // If the active particles are all in one consecutive range, // we can draw them all in a single call.gameInfo->Graphics->GetGraphicsDevice()->DrawPrimitive(D3DPT_POINTLIST,firstActiveParticle,firstFreeParticle - firstActiveParticle);  }  else  { // If the active particle range wraps past the end of the queuewww // back to the start, we must split them over two draw calls.gameInfo->Graphics->GetGraphicsDevice()->DrawPrimitive(D3DPT_POINTLIST,firstActiveParticle,settings.MaxParticles - firstActiveParticle); if (firstFreeParticle > 0) {gameInfo->Graphics->GetGraphicsDevice()->DrawPrimitive(D3DPT_POINTLIST,0,firstFreeParticle); }  }effect->EndPass();   }effect->End();    }    drawCounter++;}void ParticleSystem::RetireActiveParticles(){    float particleDuration = (float)settings.Duration;    while (firstActiveParticle != firstNewParticle)    {   // Is this particle old enough to retire?   float particleAge = currentTime - particles[firstActiveParticle].Time;   if (particleAge < particleDuration)  break;   // Remember the time at which we retired this particle.   particles[firstActiveParticle].Time = (float)drawCounter;   // Move the particle from the active to the retired queue.   firstActiveParticle++;   if (firstActiveParticle >= settings.MaxParticles)  firstActiveParticle = 0;    }}void ParticleSystem::FreeRetiredParticles(){while (firstRetiredParticle != firstActiveParticle){// Has this particle been unused long enough that// the GPU is sure to be finished with it?int age = drawCounter - (int)particles[firstRetiredParticle].Time;// The GPU is never supposed to get more than 2 frames behind the CPU.// We add 1 to that, just to be safe in case of buggy drivers that// might bend the rules and let the GPU get further behind.if (age < 3)break;// Move the particle from the retired to the free queue.firstRetiredParticle++;if (firstRetiredParticle >= settings.MaxParticles)firstRetiredParticle = 0;}}void ParticleSystem::AddNewParticlesToVertexBuffer(){int stride = sizeof(ParticleVertex);if (firstNewParticle < firstFreeParticle){// If the new particles are all in one consecutive range,// we can upload them all in a single call.void *pData = NULL;vertexBuffer->Lock(firstNewParticle * stride,(firstFreeParticle - firstNewParticle)*stride,&pData,// This may need to be indexed to write to the correct particles0);memcpy(pData,&particles[firstNewParticle],(firstFreeParticle - firstNewParticle)*stride);vertexBuffer->Unlock();//This will work if the above doesn't .../*void *pData = NULL;vertexBuffer->Lock(0,0,&pData,// This may need to be indexed to write to the correct particlesD3DLOCK_DISCARD);memcpy(pData,&particles,stride*settings.MaxParticles);vertexBuffer->Unlock();*/}else{/***********************************************This may not work!!!!!!!!!!!!!!!!!************************************************/// If the new particle range wraps past the end of the queue// back to the start, we must split them over two upload calls.void *pData = NULL;vertexBuffer->Lock(firstNewParticle * stride,(settings.MaxParticles - firstNewParticle)*stride,&pData,// This may need to be indexed to write to the correct particles0);memcpy(pData,&particles[firstNewParticle],(settings.MaxParticles - firstNewParticle)*stride);vertexBuffer->Unlock();if (firstFreeParticle > 0){vertexBuffer->Lock(0,(firstFreeParticle)*stride,&pData,// This may need to be indexed to write to the correct particles0);memcpy(pData,particles,firstFreeParticle*stride);vertexBuffer->Unlock();}}// Move the particles we just uploaded from the new to the active queue.firstNewParticle = firstFreeParticle;}void ParticleSystem::AddParticle(Math::Vector3 position, Math::Vector3 velocity){    // Figure out where in the circular queue to allocate the new particle.    int nextFreeParticle = firstFreeParticle + 1;if (nextFreeParticle >= settings.MaxParticles)   nextFreeParticle = 0;    // If there are no free particles, we just have to give up.    if (nextFreeParticle == firstRetiredParticle)   return;    // Adjust the input velocity based on how much    // this particle system wants to be affected by it.    velocity.X*=settings.EmitterVelocitySensitivity;    velocity.Y*=settings.EmitterVelocitySensitivity;    velocity.Z*=settings.EmitterVelocitySensitivity;    // Add in some random amount of horizontal velocity.    float horizontalVelocity = settings.MinHorizontalVelocity + (settings.MaxHorizontalVelocity - settings.MinHorizontalVelocity) * RandomFloat;    double horizontalAngle = RandomFloat * PI*2;    velocity.X += horizontalVelocity * (float)cos(horizontalAngle);    velocity.Z += horizontalVelocity * (float)sin(horizontalAngle);    // Add in some random amount of vertical velocity.    velocity.Y += settings.MinVerticalVelocity +   (settings.MaxVerticalVelocity - settings.MinVerticalVelocity) *  RandomFloat;    // Choose four random control values. These will be used by the vertex    // shader to give each particle a different size, rotation, and color.    Color randomValues = Color((char)LOBYTE((WORD)rand()), (char)LOBYTE((WORD)rand()), (char)LOBYTE((WORD)rand()), (char)LOBYTE((WORD)rand()));    // Fill in the particle vertex structure.    particles[firstFreeParticle].Position = position;    particles[firstFreeParticle].Velocity = velocity;    particles[firstFreeParticle].Random = randomValues;    particles[firstFreeParticle].Time = currentTime;    firstFreeParticle = nextFreeParticle;}void ParticleSystem::ScaleFactor(float scale){scaleFactor = scale;}void EffectManager::Release(){delete Manager;}EffectManager::~EffectManager(){{map<string, ParticleSystem*>::iterator iter = systemMap.begin();while(iter!=systemMap.end()){delete iter->second;iter++;}}{map<string, ParticleRetriever>::iterator iter = retrieverMap.begin();while(iter!=retrieverMap.end()){delete iter->second;iter++;}}}ParticleSystem::~ParticleSystem(){delete [] particles;}Particle.fx -- comes from the XNA example//-----------------------------------------------------------------------------// ParticleEffect.fx//// Microsoft XNA Community Game Platform// Copyright (C) Microsoft Corporation. All rights reserved.//-----------------------------------------------------------------------------// Camera parameters.float4x4 View;float4x4 Projection;float ViewportHeight;// The current time, in seconds.float CurrentTime;// Parameters describing how the particles animate.float Duration;float DurationRandomness;float3 Gravity;float EndVelocity;float4 MinColor;float4 MaxColor;// These float2 parameters describe the min and max of a range.// The actual value is chosen differently for each particle,// interpolating between x and y by some random amount.float2 RotateSpeed;float2 StartSize;float2 EndSize;// Particle texture and sampler.texture Texture;sampler Sampler = sampler_state{    Texture = (Texture);   MinFilter = Linear;    MagFilter = Linear;    MipFilter = Point;   AddressU = Clamp;    AddressV = Clamp;};// Vertex shader input structure describes the start position and// velocity of the particle, and the time at which it was created,// along with some random values that affect its size and rotation.struct VertexShaderInput{    float3 Position : POSITION0;    float3 Velocity : NORMAL0;    float4 Random : COLOR0;    float Time : TEXCOORD0;};// Vertex shader output structure specifies the position, size, and// color of the particle, plus a 2x2 rotation matrix (packed into// a float4 value because we don't have enough color interpolators// to send this directly as a float2x2).struct VertexShaderOutput{    float4 Position : POSITION0;    float Size : PSIZE0;    float4 Color : COLOR0;    float4 Rotation : COLOR1;};// Vertex shader helper for computing the position of a particle.float4 ComputeParticlePosition(float3 position, float3 velocity, float age, float normalizedAge){    float startVelocity = length(velocity);    // Work out how fast the particle should be moving at the end of its life,    // by applying a constant scaling factor to its starting velocity.    float endVelocity = startVelocity * EndVelocity;   // Our particles have constant acceleration, so given a starting velocity    // S and ending velocity E, at time T their velocity should be S + (E-S)*T.    // The particle position is the sum of this velocity over the range 0 to T.    // To compute the position directly, we must integrate the velocity    // equation. Integrating S + (E-S)*T for T produces S*T + (E-S)*T*T/2.    float velocityIntegral = startVelocity * normalizedAge +    (endVelocity - startVelocity) * normalizedAge * normalizedAge / 2;    position += normalize(velocity) * velocityIntegral * Duration;   // Apply the gravitational force.    position += Gravity * age * normalizedAge;   // Apply the camera view and projection transforms.    return mul(mul(float4(position, 1), View), Projection);}// Vertex shader helper for computing the size of a particle.float ComputeParticleSize(float4 projectedPosition, float randomValue, float normalizedAge){    // Apply a random factor to make each particle a slightly different size.    float startSize = lerp(StartSize.x, StartSize.y, randomValue);    float endSize = lerp(EndSize.x, EndSize.y, randomValue);   // Compute the actual size based on the age of the particle.    float size = lerp(startSize, endSize, normalizedAge);   // Project the size into screen coordinates.    return size * Projection._m11 / projectedPosition.w * ViewportHeight / 2;}// Vertex shader helper for computing the color of a particle.float4 ComputeParticleColor(float4 projectedPosition,   float randomValue, float normalizedAge){    // Apply a random factor to make each particle a slightly different color.    float4 color = lerp(MinColor, MaxColor, randomValue);   // Fade the alpha based on the age of the particle. This curve is hard coded    // to make the particle fade in fairly quickly, then fade out more slowly:    // plot x*(1-x)*(1-x) for x=0:1 in a graphing program if you want to see what    // this looks like. The 6.7 scaling factor normalizes the curve so the alpha    // will reach all the way up to fully solid.   color.a *= normalizedAge * (1-normalizedAge) * (1-normalizedAge) * 6.7;   // On Xbox, point sprites are clipped away entirely as soon as their center    // point moves off the screen, even when rest of the sprite should still be    // visible. This causes an irritating flicker when large particles reach the    // edge of the screen. We can hide this problem by fading the sprite out    // slightly before it is about to get clipped.#ifdef XBOX    float2 screenPosition = abs(projectedPosition.xy / projectedPosition.w);   float distanceFromBorder = 1 - max(screenPosition.x, screenPosition.y);   // The value 16 is chosen arbitrarily. Make this smaller to fade particles    // out sooner, or larger to fade them later (which can cause visible popping).    color.a *= saturate(distanceFromBorder * 16);#endif   return color;}// Vertex shader helper for computing the rotation of a particle.float4 ComputeParticleRotation(float randomValue, float age){   // Apply a random factor to make each particle rotate at a different speed.    float rotateSpeed = lerp(RotateSpeed.x, RotateSpeed.y, randomValue);   float rotation = rotateSpeed * age;    // Compute a 2x2 rotation matrix.    float c = cos(rotation);    float s = sin(rotation);   float4 rotationMatrix = float4(c, -s, s, c);   // Normally we would output this matrix using a texture coordinate interpolator,    // but texture coordinates are generated directly by the hardware when drawing    // point sprites. So we have to use a color interpolator instead. Only trouble    // is, color interpolators are clamped to the range 0 to 1. Our rotation values    // range from -1 to 1, so we have to scale them to avoid unwanted clamping.   rotationMatrix *= 0.5;    rotationMatrix += 0.5;   return rotationMatrix;}// Custom vertex shader animates particles entirely on the GPU.VertexShaderOutput ParticleVertexShader(VertexShaderInput input){    VertexShaderOutput output;   // Compute the age of the particle.    float age = CurrentTime - input.Time;   // Apply a random factor to make different particles age at different rates.    age *= 1 + input.Random.x * DurationRandomness;   // Normalize the age into the range zero to one.    float normalizedAge = saturate(age / Duration);    // Compute the particle position, size, color, and rotation.    output.Position = ComputeParticlePosition(input.Position, input.Velocity, age, normalizedAge);   output.Size = ComputeParticleSize(output.Position, input.Random.y, normalizedAge);    output.Color = ComputeParticleColor(output.Position, input.Random.z, normalizedAge);    output.Rotation = ComputeParticleRotation(input.Random.w, age);   return output;}// Pixel shader input structure for particles that do not rotate.struct NonRotatingPixelShaderInput{    float4 Color : COLOR0;    #ifdef XBOX    float2 TextureCoordinate : SPRITETEXCOORD;#else    float2 TextureCoordinate : TEXCOORD0;#endif};// Pixel shader for drawing particles that do not rotate.float4 NonRotatingPixelShader(NonRotatingPixelShaderInput input) : COLOR0{    return tex2D(Sampler, input.TextureCoordinate) * input.Color;}// Pixel shader input structure for particles that can rotate.struct RotatingPixelShaderInput{    float4 Color : COLOR0;    float4 Rotation : COLOR1;    #ifdef XBOX    float2 TextureCoordinate : SPRITETEXCOORD;#else    float2 TextureCoordinate : TEXCOORD0;#endif};// Pixel shader for drawing particles that can rotate. It is not actually// possible to rotate a point sprite, so instead we rotate our texture// coordinates. Leaving the sprite the regular way up but rotating the// texture has the exact same effect as if we were able to rotate the// point sprite itself.float4 RotatingPixelShader(RotatingPixelShaderInput input) : COLOR0{    float2 textureCoordinate = input.TextureCoordinate;    // We want to rotate around the middle of the particle, not the origin,    // so we offset the texture coordinate accordingly.    textureCoordinate -= 0.5;   // Apply the rotation matrix, after rescaling it back from the packed    // color interpolator format into a full -1 to 1 range.    float4 rotation = input.Rotation * 2 - 1;   textureCoordinate = mul(textureCoordinate, float2x2(rotation));   // Point sprites are squares. So are textures. When we rotate one square    // inside another square, the corners of the texture will go past the    // edge of the point sprite and get clipped. To avoid this, we scale    // our texture coordinates to make sure the entire square can be rotated    // inside the point sprite without any clipping.    textureCoordinate *= sqrt(2);   // Undo the offset used to control the rotation origin.    textureCoordinate += 0.5;    return tex2D(Sampler, textureCoordinate) * input.Color;}// Effect technique for drawing particles that do not rotate. Works with shader 1.1.technique NonRotatingParticles{    pass P0    {   AlphaBlendEnable =true;   //DestBlend = 6;  // SrcBlend = 5;   VertexShader = compile vs_1_1 ParticleVertexShader();   PixelShader = compile ps_1_1 NonRotatingPixelShader();    }}// Effect technique for drawing particles that can rotate. Requires shader 2.0.technique RotatingParticles{    pass P0    {AlphaBlendEnable =true;  // DestBlend = 6;   //SrcBlend = 5;   VertexShader = compile vs_1_1 ParticleVertexShader();   PixelShader = compile ps_2_0 RotatingPixelShader();    }}Thanks,John   
  I did not try to compile your code, but your vertex declaration doesn't look right at first glance.  My vertex declaration contains: D3DDECLUSAGE_POSITION, D3DDECLUSAGE_PSIZE, D3DDECLUSAGE_COLORHope that helps...   