
07-30-2005, 12:56 PM
|
 |
Centurion
|
|
Join Date: Jan 2005
Posts: 100
|
|
Quite funny this. I read your post and thought 'Ah! Someone's asked a similar question before. I'll guide them to the post that tried to tackle this problem'. When I found the post, I realised that it was you who started that topic off some time ago!
Anyway...I have looked into the problem. I must admit that I haven't fully solved it yet but what I have done is a start.
Render your Direct3D images to a picture box and present them. Then draw your lines and circles on to the picture box. You said previously that you did this but the image was very flickery. To eliminate the flicker, you'll need to copy the image in the picture box to your main picture box (same principle as double buffering). To do that,you could use the windows API BitBlt function:
Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
hDestDC: The device context of the picture box you're blitting to.
X,Y: The X and Y coordinates of the where you want the image to be drawn to.
nWidth,nHeight: The width and height of the image you want to copy.
hSrcDC: The device context of the picture box you're copying from.
xSrc,ySrc: The X and Y coordinates of the image you want to copy.
dwRop: The Blitting operation. In other words, what do you want the function to do? Because you want to copy a picture, you need to pass &HCC0020 in this parameter.
I've attached some source code to demonstrate this principle. When you run the program, you will see two picture boxes: one with a flickery image and the other with a nice and stable image.
The only problem with this program is that it doesn't work if the picture box is hidden. This is something I have not yet found out how to remedy, but I'm still looking into it. Hopefully, either you or some other members can help out here.
--The Hoplite
|
__________________
VDXLib: Open Source DirectX Library for Visual Basic. http://vdxlib.sourceforge.net/
Latest news 30 Sep 2005:
-DirectAudio8 library RELEASED - DirectAudio8 FULL documentation RELEASED - DirectAudio8 samples RELEASED
|