Jump to content
  • Advertisement
Sign in to follow this  

Direct2D Drawing Using 3D Points

This topic is 667 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


I have a project where my task now is draw some arbitrary patterns on map.

my idea was to draw this patterns using direct2d drawing function for point and other primitives and then pass this full patterned texture to pixel shader and show that texture on map.

at first this idea seems correct and fit to this problem well.

the pseudo code that maps 3d points to 2d space is this:


void AddPatternPoint(D3DXVECTOR3 p)// Gets Point On Map,so "p" is picked position on map.


   //suppose my texture is 800x800 that will send to shader i convert to 2d below:

    D3DXVECTOR2 point2d;

    point2d.x=p.x/limit.x;//limit is max value on map in x direction

    point2d.y=p.z/limitz;//like limitx this is max value in z direction

    point2d.x*=800;//scale to new coordinates


    point2d.y=800-point2d.y;//revert coordinates as my coordinates is inverse in compare to direct2d coordinates.

    //reset of the code is to save that point and draw it




after is pass this point to direct2d for drawing it will not map correctly to where i selected,also i have to mention that picking and finding point on map is well tested and is working well and correctly.

any idea about what is wrong with this approach and this code?

anyone have better idea to implement such feature?

any DPI problem or something?


many thanks!

Edited by PyemanKOP

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!