Solved

problem with RGB color mode

Posted on 2002-03-14
2
311 Views
Last Modified: 2013-12-26
Hi guys!! i'm having a problem with RGB color mode. in my computer (5x6x5) the game works pretty well, but on other computers (my friends') the color mode is said to be "not supported", i'm wondering why is that? here's the code i've been using in my program:

// get pixel format
     ddsd.dwSize  = sizeof(ddsd);
     ddsd.dwFlags = DDSD_PIXELFORMAT;
     if (FAILED(lpddsprimary->GetSurfaceDesc(&ddsd)))
          {WriteError("DirectDraw: Pixel Format not available"); return(0);}

     // get color type (5x5x5 or 5x6x5), we need only green value
     int g = ddsd.ddpfPixelFormat.dwGBitMask>>5; // throw 5 bits used for red
     if (g == 0x1F) color_type = _5x5x5_;          // 0x1F = 31 (5 bit)
     else if (g == 0x3F) color_type = _5x6x5_;     // 0x3F = 63 (6 bit)
     else
     {
          char buff[60];
          sprintf(buff,"DirectDraw: Color Mode not supported\n"
               "(Green = %d)", g);
          WriteError(buff);     // don't know what is the color mode
          return(0);
     }

i suppose there would be no problems detecting both 5x6x5 and 5x5x5, so it shouldn't give me the message "DirectDraw: Color Mode not supported" right? so what is wrong with it? is there any other color mode i've overlooked anyhow?

thanks in advance!!!

0
Comment
Question by:techpage
2 Comments
 
LVL 3

Accepted Solution

by:
Crius earned 50 total points
ID: 6869647
Have you taken a look at dwRGBBitCount?

It's possible your friend's computer is not running in a 16 bit display (which is why you need to do a 5x6x5, or a 5x5x5 test).

If he is running a 24 bit or a 32 bit display, then the dwRGBBitCount will be 24 or 32. The code I'm reading should only be run if dwRGBBitCount is 16.
0
 
LVL 3

Author Comment

by:techpage
ID: 6871827
thanks, you're right... it is indeed the color depth, *sigh* i've been thinking it was the color mode all this time...
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now