Solved

Texture transfers

Posted on 2004-04-28
3
666 Views
Last Modified: 2013-12-26
I am using visual basic 6 and direct x 9.  In direct x one loads a texture from a .dds or .bmp file. In visual basic, one can create a picture box and draw graphics on it and then save it as a .bmp file. In order to transfer the contents of a picture box to a texture, one must save the picture as a .bmp file to disk, then reload the texture from disk as a .bmp file.  Is there a way to transfer the picture to the texture without going through the process of saving to and loading back from disk. Is there an alternative process  that I could use, bearing in mind that I want to do realtime texture modifications in the same way that one would use say the picture.line function to draw a line on a picture, I want to be able to draw a line on a mesh ?

Then, does anyone know if it is possible to texture an object in dx9 with an avi file ?

Thanks

Cybermike3D
0
Comment
Question by:cybermike3d
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 17

Accepted Solution

by:
davebytes earned 500 total points
ID: 11019697
I'm not exactly sure of the limitations in VB for doing pointer-based work, but that's the way to do it.

Actually, both answers can work the same.

You want a dynamic texture, USAGE_DYNAMIC.  That is, one whose data is going to change frequently.  Create a raw D3D texture object of the correct dimensions (again, I always suggest keeping to power-of-2 for cleanliness...).  I'd likely suggest making it a raw ARGB8888 format.  CreateTexture off the device, or D3DXCreateTexture will both work.

Then, when the source changes, LockRect the entire texture, giving you a ptr, and an offset per row.  Grab a DIB from the bitmap, and walk the two step by step copying pixels for each row, then jumping to the start of the new row of data.

Similar approach for an AVI.  Decompress into a memory buffer, lock a texture, copy the data.

There are more optimal approaches using functions like D3DXFillTexture to simplify raw byte-processing through the texture (just need the source data), or D3DXLoadSurfaceFromMemory which might work better for auto-converting data formats for you without need to walk either surface directly.

d
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question