Archived

This topic is now archived and is closed to further replies.

gajraaj

Point Size Scaling

Recommended Posts

gajraaj    122
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.

Share this post


Link to post
Share on other sites
gajraaj    122
After searching on gamedev and using the code given here, I tried again but to no avail.
Namely I did the following:

g_pd3dDevice->SetRenderState(D3DRS_POINTSCALEENABLE, TRUE);
g_pd3dDevice->SetRenderState( D3DRS_POINTSPRITEENABLE, 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) ); // Default 1.0

g_pd3dDevice->SetRenderState( D3DRS_POINTSCALE_B, FtoDW(0.0f) ); // Default 0.0

g_pd3dDevice->SetRenderState( D3DRS_POINTSCALE_C, FtoDW(1.0f) ); // Default 0.0

AND

checked for the usage flags in CreatevertexBuffer and changed them to:

D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY | D3DUSAGE_POINTS, D3DFVF_CUSTOMVERTEX


Howevere, no change, but in using the REF Device I can change the point size to anything less than 64(max allowed for my gfx card) and it works as per expectation. WHY>?

I would really appreciate some help.

Thanks in advance.

Share this post


Link to post
Share on other sites