Click to See Complete Forum and Search --> : Point Size Scaling-DirectX


gajraaj
May 27th, 2004, 05:39 AM
How do I scale the size for a point sprite?

These are the steps I followed:
1) Specify untransformed vertices that do NOT have a size component
2) SEt the 3 Render States:
D3DRS_POINTSPRITEENABLE to false
D3DRS_FILLMODE to D3DFILL_POINT
D3DRS_POINTSIZE to either max size supported by the HW(in my case 64) or 1.0.
3) Specify the size AFTER the transformations(World,View, Projection) have been applied in the Render method and BEFORE the actual DrawPrimitive() call by invoking SetRenderState(D3DRS_POINTSIZE....) because the documentation states that:
"Float value that specifies the size to use for point size computation in cases where point size is not specified for each vertex. This value is not used when the vertex contains point size. This value is in screen space units if D3DRS_POINTSCALEENABLE is FALSE; otherwise this value is in world space units. The default value is 1.0f. The range for this value is greater than or equal to 0.0f. Because the IDirect3DDevice8::SetRenderState method accepts DWORD values, your application must cast a variable that contains the value, as shown in the following code example. "

=>That since I supply the point size after I apply the transformations and before I render the scene, its in screen space units and not world space units.

However, if I use the HAL device, I can see the points rendered as 1 pixel(???) but I can see the sprites scaled to max size using the reference rasterizer.

I tried the following already:
1) D3DRS_POINTSPRITEENABLE to false =>No change
2) Applying the transofmrations after setting the render states =>No change

Any help will be appreciated.

Thanks.