#### Archived

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

# Point Sprites: D3DRS_POINTSIZE interference

This topic is 5072 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am using pointsprites with DirectX9 with the following render states: PointSpriteEnable = True; PointScale_A = 0; PointScale_B = 0; PointScale_C = 10; PointScaleEnable = True; PointSize_Min = 1; PointSize_Max = 64; PointSize = 32; Here is my point sprite vertex format: #define POINTSPRITEVERTEX (D3DFVF_DIFFUSE | D3DFVF_PSIZE | D3DFVF_XYZ) My #1 problem is that the pointsprite is using the PointSize render state rather than the size which I am passing in per-pointsprite, and I definitely don''t want this. I know this is what''s happening - obviously I''ve missed something in the documentation - could someone point me in the right direction? Thanks a lot.

##### Share on other sites
Is your vertex structure defined as follows:

// Vertex Structure for XYZ Position , Point Size, and the Diffuse Color.struct VERTEX_XYZ_PSIZE_DIFFUSE{    D3DXVECTOR3 v;	float       fPointSize;    D3DCOLOR    color;};

Are you creating your Vertext Buffer as follows:

   pD3DDevice->CreateVertexBuffer( m_dwDiscard *                                 sizeof(VERTEX_XYZ_PSIZE_DIFFUSE),                                 D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY | D3DUSAGE_POINTS,                                 3DFVF_VERTEX_XYZ_PSIZE_DIFFUSE, D3DPOOL_DEFAULT,                               &m_pVB )))

_______________________________________
Understanding is a three edged sword...

[edited by - Sean Doherty on November 11, 2003 6:27:50 PM]

##### Share on other sites
Thanks for the response - I do have the correct vertex structure:
class PointSpriteVertex
{
public:
D3DXVECTOR3 position;
float size;
unsigned int color;
};

Looks right anyway... and the vertex buffer is getting created with D3DUSAGE_POINTS.

The size for some reason is bound the the D3DRS_POINTSIZE render state, and not the size I am passing in.

Thanks anyway - please let me know if you have any other ideas.

##### Share on other sites
i had a similar problem a while ago
a friend who is a gfx programer told me to change the device from hardware vertex processing to software it worked but it affected my performance on other stuff(not acceptable in my book)
i tried a few other things my self and one worked this was a while ago i cant remember what the hell it was hope the device thing work also i am told if your card cant do point size computations then all pointsprites rendered on that pass will be the same size in D3DRS_POINTSIZE.

##### Share on other sites
That was it - thanks a lot. I needed to use software vertex processing to take advantage of per pointsprite size defintions. I am using a GeForce4. I now understand the problems I was having when using a GeForce3. It seems as though video cards do not support pointsprites very well... maybe one day...

Thanks again.

##### Share on other sites
Have you checked ( D3DCaps9::FVFCaps & D3DFVFCAPS_PSIZE )?
If the GF3 reported that it supported per-vertex point-size, yet didn''t, you should file devrel@nvidia a bug report.

##### Share on other sites
I have this same problem. However, per-vertex is supported on my card. If I setup one particle emitter class, either with per-vertex or without it, everything works fine. But if I have two instances of the emitter, and one of them is set to non-per-vertex rendering and it calls SetRenderState(D3DRS_POINTSIZE, FLOAT2DWORD(SomeValue)); then both render at that size from then on.

It seems that if you call SetRenderState(D3DRS_POINTSIZE, FLOAT2DWORD(SomeValue)); EVER, it ignores per-vertex from then on, no matter what it supports. Whether this is a bug with the video card or directX, I don't know.

It works great with SOFTWARE_VERTEX_RENDERING, so my guess is it's a card issue. I have a Radeon 9200 Pro, so it's not just a GeForce thing. Anyone else see this before? Is there a way to RESET the card to use per-vertex settings again? It's not in the SDK. The SDK just says POINT_SIZE is ignored when per-vertex data is being used. This is truly not the case with my video card.

EDIT: After much further investigation, it appears to probably be a video card bug. I can turn on REF and it's fine. What I realized is that the D3DRS_POINTSIZE sticks with each scene. It's like once you call the SetRenderState function and set the POINTSIZE to some value and call draw primitive, every other drawprimitive call in that scene will use that point size, no matter how many other times you set it to a different value. It's permanently latched until you end the scene and present it.

Chris

[edited by - Supernat02 on January 24, 2004 12:50:45 AM]

• ### Forum Statistics

• Total Topics
628682
• Total Posts
2984198

• 13
• 12
• 9
• 10
• 10