Bits to DirectX surface

Started by
9 comments, last by madfisher 21 years, 7 months ago
Hi, I was wondering if there was a way to write a pointer of BYTES obtained: LPBYTE lpDIB = (LPBYTE) GlobalLock( hBitmap ); directly to a directx surface. The hBitmap is defined as a HBITMAP, but it is however a DIB. If not what is the best way for me to write the DIB to a directx surface? Thanks Marcus de Leon
Advertisement
(a) create a texture
(b) render a quad

Alternatively, use the sprite class provided.

Direct access - IMHO not.


Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)
RegardsThomas TomiczekTHONA Consulting Ltd.(Microsoft MVP C#/.NET)
directx 7 or 8 ?
DirectX 8.
IMHO?
In My Humble Opinion
Lucas Henekswww.ionforge.com
or sometimes In My Honest Opinion
with no Humbleness implied ;-)
Lock the target surface, and write pixel-by-pixel, converting the pixel format as you go. (most likely, you won't have a B8G8R8 format for the surface)
Edit:
oh and unlock it when you're done

- JQ
Full Speed Games. Coming soon.

[edited by - JonnyQuest on August 29, 2002 10:04:38 AM]
~phil
How fast will writing pixel by pixel to a surface be?

Here is my overall problem. I am getting a HBITMAP as a DIB from a third party dll. Right now I am writing the HBITMAP info to a HDC using the StretchDIBits function (Can''t use BitBlt b/c it''s a DIB). The HDC is then written to a back buffer in DirectX. Then the back buffer is flipped and the graphic is displayed. These graphics are tiles for a tile based world.

This is really slow. What is the easiest way to speed this up?

NOTE: I''m also fairly new at this type of programming.

Thanks in advance.
Also..
Can do you think it is possible to directly write the DIB I get from the 3rd party to the directX backbuffer surface?

This topic is closed to new replies.

Advertisement