SpriteDX9 Lib - New release - v0.58

Developed or developing a new product in PureBasic? Tell the world about it.
jrw
User
User
Posts: 24
Joined: Fri Jul 18, 2003 6:25 pm

Post by jrw »

very nice lib, is it possible to have InitMovieDX9() ?. Maybe this would solve the crashes I have with this code?

Code: Select all

; /************************************************************************************* 
; / Render movie to DX9 screen
; /************************************************************************************* 

  InitSpriteDX9() 
  InitKeyboard() 
  InitMovie()
; -------- Run Windowed/FullScreen Mode? and Open DirectX9 Screen -------- 

  lResult = MessageRequester("Please select:","Run example in FullScreen mode?",#PB_MessageRequester_YesNo) 
      
  If lResult = #PB_MessageRequester_No      ; User pressed NoButton 
    lMode = #PB_D3D_Windowed|#PB_D3D_AlphaBlending|#PB_D3D_AntiAliasing4 
    hScreen = OpenScreenDX9(1280,960,32,OpenWindow(0,0,0,1280,960,#PB_Window_ScreenCentered|#PB_Window_SystemMenu,"SpriteDX9 Example"),lMode) 
   Else                                      ; User pressed YesButton 
    lMode = #PB_D3D_AntiAliasing4 |#PB_D3D_AlphaBlending 
    hScreen = OpenScreenDX9(1280,960,32,"Movie Example",lMode) 
  EndIf 
    
  If hScreen = 0 
    MessageRequester("Error","Cant open DirectX9 Screen",0) 
    End 
  EndIf 

; -------- MainLoop -------- 
  MFile$ = OpenFileRequester("","","video files|*.mpg;*.mpeg;*.avi",0)
  LoadMovie(0,MFile$)
  Surface = CreateSpriteDX9(1280, 960) 
  PlayMovie(0, #PB_Movie_Rendered) 

  Repeat 
    ClearScreenDX9(RGBA(0,0,100,0)) 
    StartDX9() 
      RenderMovieFrame(Surface)
      DisplaySpriteDX9(Surface,0,0)
    StopDX9() 
    FlipBuffersDX9() 
  DisableDebugger 
  ; -------- Check Window Events -------- 
  
  lEvent.l = WindowEvent() 
  While lEvent 
    If lEvent = #PB_Event_CloseWindow 
      wQuit.w = 1 
    EndIf 
    lEvent = WindowEvent() 
  Wend 
  
  ; -------- Check if ESCAPE pressed -------- 
  
  ExamineKeyboard() 
  
  Until KeyboardPushed(#PB_Key_Escape) Or wQuit 
  EnableDebugger 
  
  ; -------- Quit and free all Stuff --------  
  
  FreeMovie(0)
  CloseScreenDX9() 
End 
  
; /EOL  
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

hi jrw:
thanks for your feedback! You cant mix SpriteDX9 commands with any normal PBSprite or PBTexture commands! There are differents and so it may not work! I dont know if something like InitMovieDX9() is planed for the future but i think Deeem2031 will spent his time first to complete and fix his SpriteDX9 lib! I will inform Deeem2031 about your wish ;)
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
jrw
User
User
Posts: 24
Joined: Fri Jul 18, 2003 6:25 pm

Post by jrw »

hey thanks

no problem :)
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Pity that this lib doesn't work and crash in some modern PCs :cry:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

Psychophanta wrote:Pity that this lib doesn't work and crash in some modern PCs :cry:
Did you test some compiled programs?
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

No, but examples from the SpriteDX9 pack don't work.
I need a lib like this, but working.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

I have compiled the latest example, could you say us if it's running?

http://djes.free.fr/test.zip
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Great work ! Thanx va!n and Deeem2031 :wink:

It works, but eats 100% CPU time :x

Now it works all. After i put the d3dx9_24.dll in system32 folder, but all examples are 100% CPU intensive :cry: As long as i know, DX9 provides a special waitforvsync function which does not poll the Vsync vga register every time, but it does it using VGA hardware in order to not to poll any register and save all CPU time. Perhaps FlipBuffersDX9() has the fault.

On the other hand, what about 3D collisions? isn't nicely supported by DX9?
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

@Psychophanta
thanks! ;) could you tell us please, what happens when saying it does not works on some modern pc´s? is there directx9.0+ installed and does the d3dx9_24.dll in system32 folder exist? Seems you dont have longer any problems to get the examples running since installing d3dx9_24.dll, right?

i dont know nor heared something about the special DX9 waitforsync function! but i will search at google and will inform Deeem2031 about this feature!

about the 3d collision stuffs... only Deeem2031 can tell you when he will add this features! but just be patienced and wait for next versions with some nice features! :wink:

@djes:
thanks for your help! your example works fine here! :wink:

general info:
yes, all examples are taking 100% CPU power as its mostly normal for games/demos/intros... if you want reduce the CPU usage a bit, you can
add a Delay(1) inside the loop or something like this!

if you have problems that your examples will exit or crash after some time... we know about this! Its a small bug that will be fixed soon!
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

va!n wrote:@Psychophanta
thanks! ;) could you tell us please, what happens when saying it does not works on some modern pc´s? is there directx9.0+ installed and does the d3dx9_24.dll in system32 folder exist?
Sorry, i was wrong, the problem was the absence of d3dx9_24.dll.
va!n wrote:Seems you dont have longer any problems to get the examples running since installing d3dx9_24.dll, right?
Exact. But a normal pc with winxp and DX9 installed doesn't include that dll. :?
va!n wrote:i dont know nor heared something about the special DX9 waitforsync function! but i will search at google and will inform Deeem2031 about this feature!
Seems vsync interrupt is supported in DirectX9b.

DdWaitForVerticalBlank:
The DdWaitForVerticalBlank callback function returns the vertical blank status of the device.

DdVideoPortWaitForSync:
The DdVideoPortWaitForSync callback function waits until the next vertical synch occurs.

Managed: Caps.VerticalBlankInterrupt Property;


But no more info I can find on internet.

And the Win DDK function:

DdVideoPortGetLine
The DdVideoPortGetLine callback function returns the current line number of the hardware video port.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

As far as I know, the vbl isn't really useful on modern PC. For 3D, timers is the way to go (badly!), especially for tft monitors.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

@Psychophanta:
Mhhhh, i am not sure if the specific dll is included since DirectX9.0c!? I had some productions, requiring that specific dll! (i will check the latest dx package soon!)

thanks for your vbl info... i searched this morning on the web and found some possible stuff and i talked with Deeem2031 about that!

here is the stuff i found... (maybe it may be from interest for someone!?)

Code: Select all

void vsync(void)
{
// wait for verticle retrace to avoid flicker
while (inportb(0x3da) & 0x08);
/* vga is in retrace */
while (!(inportb(0x3da) & 0x08));
/* wait for start of retrace */
}

Then all you need to do is modify your do-while loop in main() to look like this:

do
{
set_hot(); // generate random hotspots
mk_lines(); // do all the math and screen updating
vsync();
flip(); // move your new frame to the video screen
} while(!kbhit());
@djes:
ohhh.. i heared something about that problem long time ago! so vbl isnt possible on tft? how to solve the problem with tft`s? any infos?
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

Hey MrVa!n!

Here what I found about vbl and windows :

http://www.compuphase.com/vretrace.htm#VRETRACE_WHY
http://www.gamedev.net/community/forums ... 1&#2100842

It seems that port command is forbidden under Windows NT, 2000, xp, etc; the only way to go would be to create a driver to operate on ring 0. By the way, it's not really useful, it would be simpler (but not better as always ;) ) to rely on Windows and DirectX "DdWaitForVerticalBlank" and "WaitForVerticalBlank", even if not all gfx cards are supporting it.

Badly, tft are subjects to refresh problems too, but I haven't found any documentation by now. DirectX again, for sure...
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

hi djes!
thanks for your links! i will report this to Deeem2031 ;)
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

here are some news from Deeem2031 (translated) ...
since he dont posted any news for long time, he released a new version - however its not completely finished and still a beta version. he changed the whole system and so he had to recode nearly all procedures new. the consequence was that some stuff strangely doesnt seems to work. for example when you try to use LoadTexture(), StartDx9() may crash - even when he see there at all no internally connection...

Otherwise he still not found any error, but he may be sure that there are still some bugs inside - even when he didnt changed so much except the system.

- DrawTextDX9() fixed
- TriangleDX9() added
- #PB_D3D_NoVsync added (Vsync is now enabled by Default)
- the Library now works with D3DX9_24.dll, D3DX9_25.dll, D3DX9_26.dll Or D3DX9_27.dll (D3DX9_27.dll prefered)
- TextureWidthDX9() / TextureHeightDX9() added
Last edited by va!n on Tue Sep 27, 2005 10:13 pm, edited 1 time in total.
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Post Reply