Jump to content
  • Advertisement

Archived

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

Peregrine

Mangled bitmaps when blitting sprite in video memory!

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Help! I am unable to get sprites (BOB's) to display properly when loaded into VRAM using the following code. Only those of 800x600 the resolution that my game is set at - will display properly; almost all other types of bitmaps will be severly mangled. However, when loaded into system memory, everything is perfect (but slow). This is code from a slightly modified version of Andre Lamothe's WGPDUMB game engine running in 16-bit colour. Can anyone tell me what's wrong? int Create_BOB(BITMAP_OBJ_PTR bob, // the bob to create int width, int height) // size of BOB { // Create the BOB object, note that all BOBs // are created as offscreen surfaces in VRAM as the // default, if you want to use system memory then // set flags equal to DDSCAPS_SYSTEMMEMORY DDSURFACEDESC ddsd; // used to create surface if (bob->status == BOB_CREATED) // Destroy the BOB if it has already Destroy_BOB (bob); // been created // set state and attributes of BOB bob->image = NULL; // set position to 0 bob->x = bob->y = 0; // set to access caps, width, and height memset(&ddsd,0,sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS / DDSD_WIDTH / DDSD_HEIGHT; // set dimensions of the new bitmap surface ddsd.dwWidth = bob -> surfaceWidth = bob->width = width; ddsd.dwHeight = bob -> surfaceWidth = bob->height = height; // set surface to offscreen plain ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; // Try to store in VRAM if it won't be mangled // create the surface // if (lpdd->CreateSurface(&ddsd,&(bob->image),NULL)!=DD_OK) // return(0); // set color key to bright pink DDCOLORKEY colour_key; // used to set color key colour_key.dwColorSpaceLowValue = rgb16bpp (31,0,31); colour_key.dwColorSpaceHighValue = rgb16bpp (31,0,31); // now set the color key for source blitting (bob->image)->SetColorKey(DDCKEY_SRCBLT, &colour_key); // Make the whole bitmap invisible FillSurface(bob->image, colour_key.dwColorSpaceLowValue); bob->status = BOB_CREATED; // return success return(1); } // end Create_BOB Edited by - Peregrine on 3/12/00 11:38:20 PM

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!