Jump to content
  • Advertisement
Sign in to follow this  
Stefan Skrobanski

Drawing onto a D3D Texture

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

Hi Guys, Please forgive my ignorance. I'm currently developing a small application which will display a fisheye image onto the inner surface of a hemisphere using DirectX. The camera is then placed in the centre of the hemisphere looking inwards, the end result is a sort of immersive image experience. However... I would like to be able to draw arrows on the image using the mouse, I've read about the getDC() function and using GDI+ to draw onto the texture offscreen, but there's also the complication of not knowing which part of the image I have clicked on. I've seen examples of people drawing onto 3D objects before, but I cant seem to find any at the moment. Could anyone point me in the right direction?? Many thanks in advance! Stefan

Share this post


Link to post
Share on other sites
Advertisement
Without giving away too much, this is what you need to do:

1. Convert 2D mouse coordinates to 3D world coordinates
2. Cast a ray from the camera center to this 3D world coordinate and intersect it with the sphere.
3. Convert these 3D coordinates to sphere surface (2D) coordinates.
4. With these 2D coordinates you should be able to figure out the texture coordinates

with these last coordinates, you can do two things

1. Make a smaller, see-through sphere inside the larger one, and paint on this one through the use of locking, unlocking and writing to the texture buffer
2. Draw directly on the used texture through the use of locking, unlocking and writing to the texture buffer.

Share this post


Link to post
Share on other sites
Quote:
Original post by MadMax1992
Without giving away too much, this is what you need to do:

1. Convert 2D mouse coordinates to 3D world coordinates
2. Cast a ray from the camera center to this 3D world coordinate and intersect it with the sphere.
3. Convert these 3D coordinates to sphere surface (2D) coordinates.
4. With these 2D coordinates you should be able to figure out the texture coordinates


Ok, this sounds pretty good. Is there a facility for me to find the sphere surface coordinates easily using DirectX? I don't suppose you have come across any examples that could help me out?

Regards

Stefan

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!