RGB macro

This is a discussion on RGB macro within the Game Programming forums, part of the General Programming Boards category; Is there an --> existing <-- function/macro that picks out the R,G,B,A channels from a D3DCOLOR type? The closest thing ...

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    RGB macro

    Is there an --> existing <-- function/macro that picks out the R,G,B,A channels from a D3DCOLOR type? The closest thing I know is GetRValue etc... but they use a different RGB format.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  2. #2
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    To my knowledge, there are none that are provided by DX. If you want to only use D3D defined macros:
    Code:
    //HACK
    D3DCOLOR redMask = D3DCOLOR_RGBA(255, 0, 0, 0);
    D3DCOLOR redChannel = origColor & redMask;
    while( (redMask & 1) != 1)
    {
      //could use 8 if you want to rely on each channel taking up a byte
      redMask >>= 1;
      redChannel >>= 1;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. OpenGL: Pixel addition
    By Hunter2 in forum Game Programming
    Replies: 4
    Last Post: 12-15-2008, 01:36 PM
  3. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  4. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  5. Stopwatch program (need help!)
    By modnar in forum C Programming
    Replies: 9
    Last Post: 03-21-2004, 11:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21