Solved

problem with RGB color mode

Posted on 2002-03-14
2
315 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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