PDA

View Full Version : Problem switching to full screen mode



Wiering
25-06-2006, 12:00 PM
Hi everyone! Over at the IndieGamer forum we have a thread about the performance of various game engines/libraries and now everyone is writing demos that have hundreds of 32x32 sprites moving around with alpha blending and show the frame rate: http://forums.indiegamer.com/showthread.php?t=7551

I made a version for DelphiX (the new version by Micrel), but I'm having trouble switching to full screen mode. It works if I include doSystemMemory in DXDraw.Options, but then it is much too slow of course. Any ideas? http://home.wxs.nl/~mikewiering/tmp/DelphiXSpriteTest.zip

Also, it works better (higher FPS) if I leave out the BeginScene() and EndScene(), are those required for anything?

Clootie
25-06-2006, 05:41 PM
BeginScene / EndScene are required by API. But actually do [almost] nothing and don't steal a lot of CPU power from you. So, just call them once per frame [per rendertarget] and forget about them! :)

Traveler
25-06-2006, 10:42 PM
Due to the time (00:39am) I didn't look into the code. But I did try the executable and I worked just fine for me. Around 1750 (fps, I assume) both in fullscreen as well as in windowed mode.

Speeeder
26-06-2006, 01:13 AM
hm, well, as long as you do not wish to use GDI Canvas methods, leaving the BeginScene and EndScene out is fine (at least that's what I'm thinking after my experience with DelphiX).

The game worked perfectly for me (btw about the code... You know DXTimer has a .FrameRate property :))

Wiering
26-06-2006, 01:53 PM
Thanks for your replies, I just tried the executable myself and suddenly it works fine! But if I run it from the IDE (Delphi 5), it still doesn't.

It stops at DXDraws.pas(5006): FindDevice

Direct3D.EnumDevices(@EnumDeviceCallBack, rec);

Call stack:

FindDevice
EnumDirectDrawDriverCallback(nil,'Primair beeldschermstuurprogramma','display',$12F048)
DXDirectDrawEnumerate(???,???)
EnumDirectDrawDriverCallback($4556FF,'¬§??','?©‚Ä ú?ú???ø?´?¢_^[‚Ä??•]?Ç',$12F948)
Direct3DInitializing_DXDraw([idoRetainedMode..(out of bound) 7],???)
TCustomDXDraw.Initialize
TForm1.FormKeyDown(???,???,[ssAlt])
TCustomDXDraw.FormWndProc(???,$DC1854)
Sprites

I tried it in Delphi 7 and all works fine. The call stack looks pretty much the same there (including the strange symbols), but doesn't have the "out of bound". Could I be mixing up DelphiX versions or something?


BeginScene / EndScene are required by API. But actually do [almost] nothing and don't steal a lot of CPU power from you. So, just call them once per frame [per rendertarget] and forget about them! :)
Well, it does make the difference betwee 543 and 440 fps in my test...


You know DXTimer has a .FrameRate property :)
Yes, I'm using it, but I see I could have left out the LastFPS variable, that was for when I had the FPS on the title bar.

Speeeder
28-06-2006, 12:07 AM
uhm, actually 543 and 440 FPS isn't too much of a difference as running anything over 100FPS (or more like 85 or 75...) is totally useless... Aaand if you run as many less frames, the time BeginScene and EndScene consumes get less and less... At around 30 or so FPS you don't feel the diff at all :)

About versions... I've started DelphiXing with 1.05 and quickly changed to 06, and I've always used Delphi 7, so I don't really know what's the problem... What I do know is that 1.07 (after fixing those lil things I wrote down in the other topic :P) is very good on Delphi 7. :)