Advertisement Jump to content


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


D3D DIB/raw data question

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

Hello all. Firstly I am very new to DX programming, so pardon the stupid question, and, Secondly, I have searched this site but have not found a solution to my problem. I am trying to render a bitmap''s raw data to a D3D texture/surface. The raw data that I have is in memory and is simply a BYTE* to a bitmaps image data. I need to apply (blt???) this to the texture at a rate of 15+ frames per second and I cannot use any GDI calls. 1. I cannot figure out the relationship between a DIB''s raw data and what I need to copy/blt to the texture/surface. What I need is similar to what the PushSource filter is doing with the bitmaps and what a D3D renderer would do using DShowTextures.cpp/h. I have tried copying the bits (like the two examples above) using a memcpy from the rawdata to the textures rawdata but am simply getting a black surface. 2. If you are simply displaying a BMP on the surface, do you need to set up the matrices and, if so, how do you know how to set the lookat so the surface still fills the video window and still liiks correct? Any help is greatly appreciated. Thank you, Trent

Share this post

Link to post
Share on other sites
I am not shure if I understood you so if this is not what you need please reply:

in d3d8.1/d3d9 :

1) create surface (texture)
2) lock surface
3) get surface desc. ( surface pitch is what we need )
4) (y=0; y< height; y++)
memcpy(surface + y*pitch, sourcebits + y*width*bpp, width*bpp);
5)unlock surface

* not all surfaces can be locked ( lookup in dx docs )
* bpp - bits per pixel of surface/bmp
* width - width of surface/image in pixels (height ...)

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!