Skip to main content
GameDev.net gamedev.net
🔒 Locked

GDI - Ploting pixels without using SetPixel

Started by owl Jan 15, 2003 at 9:19 PM 4 replies 350+ views
Original Post
owl
owl
Darn, I was googling for hours and I can''t find info on this. Do you know how to lock a bitmap HDC and write the colors directly on memory? I need to draw the faster i can with the windows GDI, and I guess that calling the API drawing functions 100 times per frame is very much slower than ploting all the pixels at once. I tried LocalLock and GlobalLock but they always retun NULL.
[size="2"]I like the Walrus best.
LessBread
LessBread
Take a look at CreateDIBSection. You might find the DrawDib functions useful too.

// edit

Take a look at the code here winray.cpp. Examine the init_double_buffer function and the role played by the double_buffer variable. Take a look at AnimateFireScreen for a localized example of how these all come together.

[edited by - lessbread on January 15, 2003 11:01:34 PM]
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
owl
owl
LessBread... Thank you
[size="2"]I like the Walrus best.
LessBread
LessBread
Don''t thank me too soon - that example uses 8 bit graphics...
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
owl
owl
It worked just great! It took me a while to understand that the buffer is backwards and that I have to set the pixel color in BGR format


So anyways, in this sense, 4 dimensions is no good to live in, if you want to think about living in a different world, try 5.
pouya


[edited by - xaxa on January 19, 2003 3:35:45 AM]
[size="2"]I like the Walrus best.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.