Archived

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

greymaukin

Using the Blt() function in DX7

Recommended Posts

I am trying to blt a GUI for a map editor from an offscreen surface to my backbuffer. All I''m getting when I try to compile/run is black where my map should be. Can someone help me?!! (I''ve only been programming for about a week, so I''ve exhausted EVERYTHING that I could think of to try). Thanks!!! Even a broken clock is right twice a day. Grey

Share this post


Link to post
Share on other sites
Have u set the flip?
i don''t really know what happened,but u should copy the source here,then perhaps i can find the problem.

jerry2
Programming,make a whole new world.

Share this post


Link to post
Share on other sites
quote:
Original post by greymaukin
I am trying to blt a GUI for a map editor from an offscreen surface to my backbuffer. All I''m getting when I try to compile/run is black where my map should be.

Can someone help me?!! (I''ve only been programming for about a week, so I''ve exhausted EVERYTHING that I could think of to try).

Thanks!!!

Even a broken clock is right twice a day.
Grey


I am not sure but... do you flip the surfaces after blit??
yep, you should paste some of your main code.

Share this post


Link to post
Share on other sites
let me explain in more detail.. the code is rather long...
I''ve set up the flip. And as long as i use window''s GDI (BitBlt() function), the prog works fine. But i''m starting to get into LOTS of graphics, and it''s starting to drop below 30 fps. so i have to use a faster way. so what i did was i tried using the directX blt() function. i tried setting up color keys, and ddlbtfx''s but still all i get is black. i know the program still works, because i made it put an icon with bitblt to make sure. I''ve set up my display like this "SetDisplayMode(800,600,16,0,0);" my blit function is this lpddsBack->Blt(&rcDst,lpddsScreen,&rcSrc,DDBLT_WAIT | DDBLTKEYSRC, NULL, NULL);

any suggestions would be welcome, and if you need any more info let me know.. i''m on the web a lot, since i''m kinda at an impass now.. Thanks guys!

Share this post


Link to post
Share on other sites
Not really a solution, but some suggestions that hopefully may help:

1) How do you use BitBlt on DirectDraw surfaces? Do you get a DC for each one every frame (slow!)? If no, maybe they aren''t DDraw surfaces in which case you can''t Blt them.

2) Do any of your graphics go offscreen? If so, you may need to attach a clipper to the surface that you are writing to.

3) Do you write directly to the Back Buffer? That is probably easiest in your case. Just write there and then call Flip (). If not, make sure to Blt your offscreen buffer to the back buffer and then call Flip.

4) You code should look kinda like this for the above example:
Clear Back Buffer
Draw Everything to Back Buffer using Blt ()
Call Flip

Hope that helps. If you can, post some sample code (a condensed version maybe).

Share this post


Link to post
Share on other sites
i found out the problem.. i was "yatta->GetDC(&blah)" before i used "Blt(&blah)".. you can''t do that.. the surface already released it''s DC.. so there''s nothing to write to.. duh... i just pulled a stupid.. or, an i''m inexperienced... either way.. maybe my screwup will help somebody else in the future eh?
Thanks for the suggests guys... maybee one of these days i''ll help you huh?? LOL!
-grey

"the only way to relieve the stress of programing, is not to program" --somebody famous

Share this post


Link to post
Share on other sites