Thread: RGB macro

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001

    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.

    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
    To my knowledge, there are none that are provided by DX. If you want to only use D3D defined macros:
    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, 02: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-22-2004, 12:42 AM