How do i get a pointer to the display buffer in windows, so i can do memset operations on it and such?
Printable View
How do i get a pointer to the display buffer in windows, so i can do memset operations on it and such?
DirectDraw
Wow, you are just so much help! I don't know what'd I'd have done without you.
Todd gave you the correct answer to your question. You can't just grab a look the the video memory and monkey around with it in Windows. You either go through the GDI API or use the DirectDraw API which is closer to the metal.
Hope this helps
Eugene Gill
Please take the time to rate this answer if you found it useful. It will make me a happy man!
Or OpenGL.
Hope this helps
Eugene Gill
Please take the time to rate this answer if you found it useful. It will make me a happy man!
Hi, use of DirectDraw ...
I read article that was about 15 ways to set pixel in monitor in DirectDraw, it was nice ...
You can buy and read Andre LaMonthe books
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
if you just want to access the bytes of the image, say change the red channels of certain
pixels at certain location (watever), why dont you try DIB.
You should be able to find the example DIBLOOK in MSDN.
lorba
Here is how you do it:
int i=4 * bmi.bmiHeader.biWidth * bmi.bmiHeader.biHeight;
/* allocate your buffer here with something like
long *buffer = new long[i/4]; */
int iRet = GetDIBits(hDC,hBitmap,0,bitmap.bmHeight,(char *)buffer,&bmi,DIB_RGB_COLORS); // This sets the Dev Indep bits
This assumes that you are starting with a bitmap compatible with your HDC and that you want 32-bit pixels to work with in your buffer. (They are the easiest.)
Then of course you do whatever you want with the buffer, and call SetDIBits to set them again all at once. It will automatically do the conversion back to screen/device color depth.
Good luck.
Giving rating points to good posts is sexy...