Jump to content
  • Advertisement
Sign in to follow this  
akira32

How do I enlarge the point by POINTLIST

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)

Share this post


Link to post
Share on other sites
Advertisement
There's a minor "trick" involved in casting a float to a DWORD to set the point size.

float fPSize = 5.0f; // 5 pixels
pDevice->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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Original post by Buckeye

float fPSize = 5.0f; // 5 pixels
pDevice->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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!