Solved

Texture transfers

Posted on 2004-04-28
3
657 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
Flash video stream duplicate 5 361
DirectXFramework 5 117
How do I hire a good copyright attorney? 3 139
Quick photoshop favor anyone? cropping an animated GIF 5 117
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 …
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 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