How do I enlarge the point by POINTLIST

Started by
5 comments, last by Evil Steve 15 years, 9 months ago
How do I enlarge the point by POINTLIST? g_pd3dDevice->DrawPrimitive(D3DPT_POINTLIST, 0, 3); The point occupies one pixel in the screen. How do I enlarge the point?(The vertex fvf of the point is D3DFVF_XYZRHW|D3DFVF_DIFFUSE)
akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
Advertisement
Look at the states for SetRenderState, specifically D3DRS_POINTSIZE_MIN.

Why do you want to do this though? Surely drawing textured quads would be better?
There's a minor "trick" involved in casting a float to a DWORD to set the point size.
float fPSize = 5.0f; // 5 pixelspDevice->SetRenderState(D3DRS_POINTSIZE,*(DWORD*)&fPSize);


Quote:Surely drawing textured quads would be better?

Actually, drawing points of a fixed pixel size can be very convenient, in a modeling program, for instance, which shows selected vertices. The points remain the same size on the screen whatever the eye distance and their positions are easily calculated as the position of the vertex! Quick and simple.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Quote:Original post by Evil Steve
Look at the states for SetRenderState, specifically D3DRS_POINTSIZE_MIN.

Why do you want to do this though? Surely drawing textured quads would be better?


Thank you! I chaned the value of D3DRS_POINTSIZE_MIN, but it did not work. So I finded another way to change the size of the point by defining the FVF(D3DFVF_PSIZE).
#define VERTEXFVF_2D_POINT (D3DFVF_XYZRHW|D3DFVF_PSIZE|D3DFVF_DIFFUSE)

I already draw a full-screen quad on screen. And then I want to add some points on the quad.

"drawing textured quads would be better?" means what? by sprite to draw a circle replace of the point? Could you say the detail?
akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
Quote:I chaned the value of D3DRS_POINTSIZE_MIN, but it did not work

Evil Steve mistyped.[smile] It's D3DRS_POINTSIZE.

EDIT: By the way, akira32, POINTs on the screen are draw as a square of pixels of the specified size and aren't subject to perspective. They'll appear the same size on the screen no matter what their position in world-space.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Original post by Buckeye
float fPSize = 5.0f; // 5 pixelspDevice->SetRenderState(D3DRS_POINTSIZE,*(DWORD*)&fPSize);

quote]

Thank you, Buckeye! I try the D3DRS_POINTSIZE, it does work.
Sorry!Evil Steve. I try the D3DRS_POINTSIZE_MIN, it also works. I forgot the trnasformation from float to DWORD(I just used the DWORD value).
akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
Quote:Original post by akira32
"drawing textured quads would be better?" means what? by sprite to draw a circle replace of the point? Could you say the detail?
It depends on what you're trying to do. Drawing textured quads allows you to rotate the points, and apply a texture to them if you want to.

This topic is closed to new replies.

Advertisement