SetRenderStates for Points

Started by
2 comments, last by littlekid 17 years, 7 months ago
I have read through the SDK documents, I know in order to use point sprites, I have to set the following render states:

g_pd3dDevice->SetRenderState( D3DRS_POINTSPRITEENABLE, TRUE );
g_pd3dDevice->SetRenderState( D3DRS_POINTSCALEENABLE, TRUE );
g_pd3dDevice->SetRenderState( D3DRS_POINTSIZE, FtoDW(1.0) );
g_pd3dDevice->SetRenderState( D3DRS_POINTSIZE_MIN, FtoDW(1.0f) );    g_pd3dDevice->SetRenderState( D3DRS_POINTSCALE_A,  FtoDW(0.0f) );
g_pd3dDevice->SetRenderState( D3DRS_POINTSCALE_B,  FtoDW(0.0f) );
g_pd3dDevice->SetRenderState( D3DRS_POINTSCALE_C,  FtoDW(1.0f) );
What is the difference and purpose for D3DRS_POINTSCALE_A, D3DRS_POINTSCALE_B and D3DRS_POINTSCALE_C? The SDK document just says they controls the distance-based size attenuation for point primitives.
Advertisement
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/point_sprites.asp
You can find details of how they interact with each other in the SDK docs:

DirectX Graphics ->
Direct3D 9 ->
Programming Guide ->
Advanced Topics ->
Vertex Pipeline ->
Point Sprites ->
"Point Size Computations"

A is the constant factor, B is the linear factor and C is the quadratic factor that combined (see above) let you control the curve used to scale the point sprites.

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Thanks alot guys

This topic is closed to new replies.

Advertisement