Solved

problem with RGB color mode

Posted on 2002-03-14
2
312 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

912 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

21 Experts available now in Live!

Get 1:1 Help Now