XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

Displaying 8bit surface on a higher color depth mode (16, 24 or 32)

Last post 7/2/2009 8:04 AM by Xia. 3 replies.
  • 6/23/2009 3:16 AM

    Displaying 8bit surface on a higher color depth mode (16, 24 or 32)

    This might sound obsolete these days as all graphics are at least 24bit. I have ported one of my old games to windows some time back, it worked really well under full screen. Now I wanted to allow the windowed mode. I have come across a problem when I try to display the 8bit images on higher color depth mode nothing appears on the screen (under windowed mode).

     

    This what I have tried so far

     

    1. Switching to 8bit mode (windowed):  This works but I don’t want to use that cause windows look really ugly under 8bit colors and the user will be really irritated if the game switches them to lower color mode.
    2. Create 8bit surface (Video/back buffer) under 16/24 bit mode: The causes the initialization to fail i.e. the mode is sent but when I try to createsurface with the DD interface it fails.
      I am using DDSDPIXELFORMAT flag and dwRGBBitCount to set the bitmap color depth in the surface description structure.
    3. Create 24bit surface (Video/back buffer) under 24 bit mode but creating 8bit surface to load my sprites:
      With this the initialization has no issues the front & back buffers are created successfully, I am also able to create off-screen 8bit buffers and load sprites. But the actual blit fails to draw anything on the screen. My understanding was the directX should be able to handle the surfaces with different color depths.

     

    Does any one knows how to handle this, the next step is palette handling which also works fine under full screen but how to set the palette for 16/24 bit modes as these mode do not require a palette.

     

    PS: Please don’t suggest to convert the loaded 8bit surfaces to higher depth as runtime, I don’t think it’s a good solution (it could work but I just don’t like it). It should be handled by DirectX somehow.

  • 6/27/2009 7:02 AM In reply to

    Re: Displaying 8bit surface on a higher color depth mode (16, 24 or 32)

    DirectDraw is deeply deprecated. Therefore it would be hard to find someone who still knows the exact details. Based on what I could remember a DirecDraw blit operation never perform color conversion during the blit.

    I am not sure how old the hardware your game should run is. But hardware support for 8 bit palette surfaces was mostly removed some time ago. Therefore there is a high chance you game is running o the emulation layer.

    I am quite sure you would not like this but I recommend dropping DirectDraw and use Direct3D or make a bigger step to XNA Game Studio.
  • 6/27/2009 12:03 PM In reply to

    Re: Displaying 8bit surface on a higher color depth mode (16, 24 or 32)

    Its been ages since I've worked with Direct Draw (2000 was the last year I believe), but from what I recall you can't use 8 bit mode in window mode if the system is set to 16, 24, or 32 bit. Your only option is to upscale to 16/24/32 bit, or ask the user to change the resolution/graphic format to a 8 bit mode. If you look at some of the old great games like Heroes of Might and Magic 2 which were made to work with 8 bit modes (Color cycling effects and all) if you try to run them windowed with a 16 bit or higher desktop the game will fail to launch as it requires a 8 bit mode.
  • 7/2/2009 8:04 AM In reply to

    Re: Displaying 8bit surface on a higher color depth mode (16, 24 or 32)

    Well, I had completed this port back in 2000 myself and had add multiplayer support. Never got time the do the final touch-up and packaging. I just thought I do the final finishing and make it availble on the net now.
    As for moving the XNA, that was my next step. But instead of porting anything 2D, I think I will come come up with something fresh for it.
Page 1 of 1 (4 items) Previous Next