   Best way to do animation
  This isn't a game question per se, but this place seemed like a good place to ask about this.I'm doing an application where I get streaming image data (16 bits per pixel, grayscale).  I package the data into frames and then want to display those frames at some frame rate.  Right now I have a timer and every time it times out I display a new frame in my window.  I've looked at various DirectX and GDI stuff but I can't figure out how to take existing data and display it.  Anyone have any suggestions on an easy way to do this?  The data is just in a WORD array.  I feel like I should just be able to pass a pointer to some function but my understanding of graphics programming is pretty naive...Thanks,Andrew   
  For GDI, you want to look at CreateDIBSection, which creates a Device-Independent Bitmap or DIB that you can write to. You'll need to ensure that your data is in a GDI-appropriate data format; DIBs use a BITMAPINFO structure and its associated BITMAPINFOHEADER to specify image format.For DirectX, you'll want to create a texture, specifying the correct format (probably D3DFMT_X1R5G5B5), lock it, and then write to the data pointer of the corresponding D3DLOCKED_RECT structure. (Don't forget to unlock before rendering again.)Let us know how it goes.   ;  Thanks for the quick reply.  I'm still a little confused though.Say I'm using GDI...In my BITMAPINFOHEADER I define the followingbiHeight = 400biWidth = 400biBitCount = 16biCompression = BI_RGB (I want uncompressed even though my image is grayscale)biClrUsed = 0 (little confused about what this does...)But, the MSDN docs say that if you use 16 bits with BI_RGB compression then the bmiColors value in the BITMAPINFO structure must be NULL.  This is where I get lost because I thought that I had to define my own palette using the bmiColors value so that my image would be displayed as grayscale.  In other words, how do I get 2^16 shades of gray color?Thanks,Andrew   ;Quote:Original post by adpriceIn other words, how do I get 2^16 shades of gray color?Your Google-fu is weak, my son.   ;  Hah, the Google-fu isn't so weak, I just don't want to pay for the answer.   ;  Isn't it enough asking one time?   ;Quote:Original post by adpriceHah, the Google-fu isn't so weak, I just don't want to pay for the answer.Hi, try this:Search for "How can I create a 8bit grayscale bitmap?". You'll see the same link... now click to see the cached version instead. Then, just scroll to the bottom.Hope it helps ;)   ;Quote:Original post by adpriceHah, the Google-fu isn't so weak, I just don't want to pay for the answer.Scroll down. Experts Exchange is hilarious in that they put up all this for-pay stuff, but the answers are completely exposed at the bottom of the page. Yes, even outside the Google cache.Edit: Hmm. It appears it's just the Google link that busts through their money grubbing. Here. I wonder how long that will last.   ;  Sweet trick, thanks guys.Andrew   