PowerDraw getpixel code!

Started by
6 comments, last by kornalius 20 years, 11 months ago
Can anybody help me here. I am so close to get this code working. The return value of variable d3dlocked from function LockRect is always filled with nil. I don''t know what I am doing wrong here. ================================================================ function GetPixel(D: TPowerDraw; x, y: integer): Cardinal; var d3dlocked: TD3DLocked_Rect; Offset: integer; r: TRect; dc: Hdc; i: HResult; begin {D.BackBuffer[1].GetDC(dc); Result := Windows.GetPixel(dc, x, y); D.BackBuffer[1].ReleaseDC(dc);} SetRect(r, x, y, x + 1, y + 1); i := D.BackBuffer[0].LockRect(d3dlocked, @r, D3DLOCK_DONOTWAIT or D3DLOCK_READONLY); Offset := (y * d3dlocked.Pitch) + (x * 2); Result := DWord(Pointer(Integer(d3dLocked.Bits) + Offset)^); D.BackBuffer[0].UnlockRect; end; ================================================================ Regards, Kornalius.
Advertisement
In order to achieve this, upon initialization back buffer must be created with D3DPRESENTFLAG_LOCKABLE_BACKBUFFER. However, this will result in decreased performance on some video cards.
As PD4 is being developed, it will have possibility to render on TAGFImage instead, which can be presented on the screen.
Thanks LifePower.

What can we expect in PD4 in terms of new features and/or enhancements?

Regards,
Kornalius
Actually, PD4 won't be really PowerDraw-named, since it will be a professional component pack with graphics, networking, database and other components, allowing to make games incredibly fast in Delphi. As it always been, we always had two PowerDraw versions, public and private one. Unfortunally as it is, PD3 final was never released to public (which we are still using) but the new component pack will be released as two - freeware version and commercial version which will be exactly the same product we use in work. I wouldn't talk about new features now because some of them may not come in final release or some will be changed, but most probably new component pack will contain both 2D and 3D graphics support (Software Renderer for both too). The deadline is one month from now, so let's see how good the library will be

[edited by - Lifepower on May 27, 2003 9:52:20 PM]
Great, I can''t wait for it. Do you have any ideas on price for now (for the commercial version)? And, will it be compatible with PD3, so I don''t have to rewrite my soon to be released visual game builder?

Regards,
Kornalius
The new library will be compatible with PD3 (but not with PD2). As for the professional version''s price - don''t know for sure now. As new version is being developed I''ll be posting (or try to post) the information and prolly some possible download.

Cheers,
Lifepower
LifePower,

Email me when you get a chance. Thanks.

Best Regards

Jarrod Davis
Jarrod Davis Software
Best RegardsJarrod DavisJarrod Davis Software
Great, I won''t have to rewrite anything then! Phew... I hope to be able to use the new features!

Regards,
Kornalius

This topic is closed to new replies.

Advertisement