• Advertisement

Archived

This topic is now archived and is closed to further replies.

DirectX 7 and VB - Surface pointers?

This topic is 5904 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. Just a quick question, but not an easy one. I want to do real-time image distortion using direct memory access, which I''ve seen in several samples that use Bruce McKinney''s CopyMemory/VarPtr technique. The effects are super fast, even with Visual Basic. I know all about GetLockedArray, but it is simply not fast enough for this purpose. DirectX for C++ returns a pointer when you create a surface, and you can also acquire a pointer through the surface description (ddsd->lpSurface). DirectX for VB has no such convenience. (The TLB programmers were on drugs or something.) Is there an undocumented technique for acquiring a surface pointer in VB? Perhaps there''s a way to do it through a C++ DLL? I''m desperate for a solution. If you can help, thanks a million.

Share this post


Link to post
Share on other sites
Advertisement
Your on to something with c++ dlls
Yeah you can verily write a dll in c++ and use it to get pass the name of the surface pointer to vb, but remember you can''t use pointers in a dll. I''m not completely sure what you should do here, but I thought I could at least tell you about the dll.
Hope you get it working.

djsomers

Share this post


Link to post
Share on other sites
The pointer you get back when you create a surface IS NOT a pointer to the actual data in video memory (or AGP or sysmem), it''s a pointer to a *private* structure which describes where the data is actually held. This description need not be an address, it can be something which only has meaning to the display drivers.

The way to access the actual data is to use a Lock() call. There are cleverer and faster ways of doing image distortion using 3D hardware though which don''t require manual locking/fiddling with the surface.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Thanks for the quick replies.

Could you elaborate on these techniques using 3D hardware? There must be some tutorials somewhere that describe how to do it. I''m still working with a friend to solve the problem through software (we''re looking very closely at GetLockedArray and GetObjectAPI, searching for any compatibility loopholes), but I''d still like to know how the same thing can be done through hardware, if only because it may be significantly faster in the long run.

I''ll post again once we have some new findings.

Share this post


Link to post
Share on other sites

  • Advertisement