Loading a bitmap into a surface and displaying it

Started by
4 comments, last by Kaldurin 21 years, 11 months ago
Hi there, I''m doing an application that loads a bitmap into a surface before doing some bltfast to copy it to the backbuffer, but when I flip the back buffer, some strange things are displayed on the screen. As if it was a chess board game but with all sorts of pixel. I could describe it as garbage. I don''t receive error message, so I don''t know where the trouble might be. Could anyone help me ? Surak
Surak
Advertisement
Double check your blitting instructions. The area you''re blitting is probably a little off and you''re blitting a part of memory that isn''t image data.
What are you using to load in the bitmap?

***********************
I''m using LoadImage under Windows 98 with the flags LR_LOADFROMFILE | LR_CREATEDIBSECTION.

Surak
Surak
Are you sure if it''s the loading of the bitmap that''s causing the problem? You could try using a different function to see if that''s the problem (like in DDUtil.h) or you could write your own function. This thread explains how to do the latter. If that doesn''t work, are you clearing the backbuffer before you blit onto it again each time? That may be causing problems if your not.

***********************
I''ve found my error ! Finally after searching for about a week and thinking on all possible errors that could be causing that, I just found that when I used SelectObject, for the second parameters, I was giving it the address of the handle to the bitmap instead of the handle to the bitmap. I can''t believe I did a stupid error like that .

Thanks anyway for you help Sassy.

Surak
Surak

This topic is closed to new replies.

Advertisement