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

getpixel

Started by nzo Jan 12, 2005 at 5:56 PM 0 replies 2.2k views
Original Post
nzo
nzo
I`m using turbopixels, and so far it has been great. A problem occurs when I want to use the get() and put() routines to copy pixels from a source surface (the locking of the surface causes me problems) so I copied the locking functions so I could get() and put() from different surfaces. However, it crashes my comp when I simultaneously try to get() from several surfaces.... Seems like a major oversight of the unit if I can't put from different "sources" to the drawing surface? I looked at powerdraw, and this also requires locking of even the get surface... why is this? tia
Sly
Sly
It is a DirectX requirement. For you to directly access the pixels of a surface, that surface must be in system memory. However, since DirectX usually manages where the surfaces are located (system memory, video memory, somewhere else?), you must tell DirectX that you want exclusive access to the surface (or a section of the surface) memory. This is why you must lock the surface.

Note that locking and unlocking a surface is a very slow operation, so you should try to minimize the number of locks that you perform every frame. Otherwise it may have an adverse affect on your framerate.

Topic Locked

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

Sign in to reply to this topic.