Archived

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

Bizarre Direct Draw behaviour.

This topic is 6077 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I am drawing a character to the screen using Direct Draw running on Windows 2000. When I run the program the character appears as a series of diagonal stripes drawn across the blitting surface. If I go into the touble shooting mode in Win2000 and set the slider to remove all accelerations I get the character to appear though without ideal performance (some flickering). I have observed this phenomenon with two graphics cards on the same machine and both cards can run Star Wars Galatic Battlegrounds perfectly acceptably. This leads me to believe that I am making some sort of obvious initialisation error. Can anyone give me a clue? Garvin.

Share on other sites
Something like that happened to me when I was running windowed mode with the desktop color depth set to 32-bit and the game was running at 16... but the hardware acceleration thing kinda throws it off.

Share on other sites
I''m running the thing in full screen mode with 256 colours. I have tried setting the properties of Windows to 256 just in case but still no joy. Anyone else out there with a clue or two?

Share on other sites
I''m probably just clutching at straws here, but could it be something to do with the pitch of the surface? It might be possible that the rows of the surface you''re drawing to aren''t contiguous in memory. When you disable acceleration the surface might be contiguous so everything works.

When you say the character is drawn as a series of diagonal stripes, do you mean something like this:

123456789....                ..123456789....123456789..                ..123456789......123456789   instead of   ..123456789..

Is there any point where you lock a surface and access it as a pixel array?

Share on other sites
Your diagram using the digits is what I believe to be going on, although the distortion is so extreme that the rendered bitmap bears no similarity to the original, except that the stripes are the same colour.

As to your question, yes, I do copy the bitmap pixel by pixel at a point in my program; using memcopy for good measure. While I appreciate that this is probably the work of a Satanist it does work for Andre Lamothe. I'll post the code later when I get home from work. In the meantime I'll give a brief overview of what I'm doing.

I'm using LaMothe's method from "Tricks...". LaMothe loads each frame of an animation onto an individual surface of it own. The program then maintains an array of surfaces for each character. The character can then be animated by selecting the correct index for the required surface/frame.

Edited by - tifkagh on February 25, 2002 4:05:50 AM

Share on other sites
Could someone point me to an outline of the structure of a DirectDraw surface so that I can get on with my own debugging in the meantime?

Share on other sites
quote:
Original post by tifkagh
Could someone point me to an outline of the structure of a DirectDraw surface so that I can get on with my own debugging in the meantime?

I don''t know about the internal structure of the COM objects, but there''s a decent picture of a general surface buffer in TOTWGPG (Page 267 in my copy).

To check if the stride of the surface is causing the problem, use GetSurfaceDesc on your all your directdraw surfaces and dump the values of "lPitch" and "dwWidth" to a file. If the program works when the they are the same, but not when they differ, that''s the problem. Make sure that you aren''t using memcpy to copy surface data when the pitch and width differ.

Share on other sites
when you lock the surface, the pitch is returned in the structure you use to retrieve the pointer to the locked surface .. be sure you are using that pitch.

Share on other sites
Also something else you may want to know is that the width of the BMP must be a multiple of 4. (Well it has to be with Lamothe''s code) Just thought I''d throw that out there. (might be something else causing problems)

Share on other sites
Got it, cheers folks.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 14
• 9
• 9
• 9
• 10
• Forum Statistics

• Total Topics
632912
• Total Posts
3009199
• Who's Online (See full list)

There are no registered users currently online

×