Blt() Problems

Started by
6 comments, last by Lutrosis 24 years, 2 months ago
I''m new to DirectX, and I''m writing a few simple programs to get myself aquianted. I wrote a little particle system(since it only required being able to put pixels) and it worked fine. Now I''m messing with animation, and I''ve hit a snag. It seems I can''t blit to the primary surface. The blit command doesn''t fail, it just doesn''t to anything. Actually, all I''m trying to do is a fill. Here''s some code fragments: DDBLTFX ddbltfx; RECT FillArea; memset(&ddbltfx,0,sizeof(DDBLTFX)); ddbltfx.dwSize=sizeof(DDBLTFX); ddbltfx.dwFillColor=Color; FillArea.bottom=479; FillArea.top=0; FillArea.left=0; FillArea.right=639; PrimarySurface->Blt(&FillArea,NULL,NULL,DDBLT_COLORFILL/DDBLT_WAIT,&ddbltfx) The screen mode is 640x480x16 bit. I''m quite sure of the _RGB16BIT() macro, so it''s not a screw-up there. The annoying part is that it''s only for a specific area of video memory(from what I can gather). I tried creating a Secondary flippable surface and blitting to that, then flipping the page, and it worked fine. But then I couldn''t blit to the secondary surface, which should still be the same video memory as the original Primary surface, if I understand page flipping properly. If anyone has any ideas as to why that section of video memory can''t be blit to, I''d really appreciate hearing them. I''m working on a simple wrapper, and blitting to the primary surface would basically complete the functionality of it. -Lutrosis Drowning in the aggrivation of not knowing what''s wrong <=]
-Lutrosis#define WHOOPS 0class DogClass {public: CDog() { printf("Ruff!"); } Run() { printf("Run!"); } Crash() { printf("%d",100/WOOPS); }};DogClass CDog;CDog.Run();CDog.Crash();
Advertisement
If this is an exact copy of the code, I''m curious as to why you are dividing DDBLT_COLORFILL by DDBLT_WAIT in the following line

PrimarySurface->Blt(&FillArea,NULL,NULL,DDBLT_COLORFILL/DDBLT_WAIT,&ddbltfx)

That should be DDBLT_COLORFILL / DDBLT_WAIT

Mark Fassett
Laughing Dragon Entertainment
http:\\www.laughing-dragon.com

Mark Fassett

Laughing Dragon Games

http://www.laughing-dragon.com

OK, I see... ignore my last post. I didn't know the board changed pipes into /

Try checking your return code from your blit call and see what it says.


Mark Fassett
Laughing Dragon Entertainment
http:\\www.laughing-dragon.com

Edited by - LaughingD on 2/16/00 11:33:26 PM

Mark Fassett

Laughing Dragon Games

http://www.laughing-dragon.com

Try changing your RECT structure so your bottom reads 480 and your right side reads 640. Those are exclusive so it includes 0-479 & 0-639.

Still Learning...
Still Learning...
That''s the strange thing. Blt() is returning DD_OK. I didn''t make this clear, but my code is actually set up to check for errors and dump them to a file if they occur. Blt() returns DD_OK, and yet still nothing happens. I''m quite confused. Any DirectX Gurus out there?

-Lutrosis
-Lutrosis#define WHOOPS 0class DogClass {public: CDog() { printf("Ruff!"); } Run() { printf("Run!"); } Crash() { printf("%d",100/WOOPS); }};DogClass CDog;CDog.Run();CDog.Crash();

Hm... Well make DDBLTFX lower case in:

memset(&ddbltfx,0,sizeof(DDBLTFX));

and

ddbltfx.dwSize=sizeof(DDBLTFX);
strange. It really sounds like the value of color isnt right. I take it the screen is black and you are trying to fill it with a color?
with your particle system have you tried writing them to the primary using the same color value.
have you tried blitting a bitmap instead of a colorfill
worth trying bltfast to make sure that works.
You arent making the mistake of blitting to the primary, then calling flip just after it i presume?
Hope these random mumblings provoke an eventual fix :-)

http://www.positech.co.uk
I just copied this code from my project, and it works correctly. It''s almost identical to your''s, except that it fills the whole surface instead of using the rect (is this what you''re trying to do?)


DDBLTFX ddbltfx;
memset((void*) &ddbltfx, 0, sizeof(ddbltfx) );

ddbltfx.dwSize = sizeof( ddbltfx );
ddbltfx.dwFillColor = RGB(0, 0, 0); // black

lpDD_Surface->Blt(NULL, NULL, NULL, DDBLT_WAIT / DDBLT_COLORFILL, &ddbltfx);



- null_pointer

This topic is closed to new replies.

Advertisement