How to Get Directx 9 Working in PB?

Everything else that doesn't fall into one of the other PB categories.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

How to Get Directx 9 Working in PB?

Post by Dreglor »

Well im starting with DXPack and it's not working
Im just trying the example, "simple triangle" it staying there is no such function with "Direct3DCreate9_" even though I put the libaries in the correct place (\PureBasic\PureLibraries\Windows\Libraries)
i also comment out "IncludeFile "Data/D3D9Interface.pbi"" becasue the directx9 interfaces is in the res file now if i don't comment that it complains that those interfaces are already there.
~Dreglor
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

I have had no enough time to test with DXpack, but seems vsync interrupt is supported in DirectX9b, so i have big interest on it:

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.

Since i have no time, i hope you or other PB users cant try with DXPack and keep me informed.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

grr im very new at this.
i ran header converter on all of the headerfiles in the directx9 sdk
i don't need to worrie about interfaces becasuse those are already converted...
but i got a bunch of files with structures and constants in them
but the functions are what im stuck how do i use the libs aren't the functions defined in the header files in the directx9 sdk?
~Dreglor
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Dreglor, or anyone; if you get DX9 working in PB, i would be very grateful if you put some small explained examples codes here or in your web page... :)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: How to Get Directx 9 Working in PB?

Post by traumatic »

Dreglor wrote:Im just trying the example, "simple triangle" it staying there is no such function with "Direct3DCreate9_" even though I put the libaries in the correct place (\PureBasic\PureLibraries\Windows\Libraries)
I had a short look into this: The actual PB-libraries are missing in the pack.

You should be able to create them using the DLLImporter on the *.pbl-files
located in /DX-Pack/DLLs and Libraries/recreate/.

Alternatively you can also call the function directly from d3d9.dll.

So for example replace this

Code: Select all

*D3D = Direct3DCreate9_(#D3D_SDK_VERSION)
by this

Code: Select all

d3d9dll.l = OpenLibrary(#PB_Any, "d3d9.dll")
If d3d9dll
  *F = IsFunction(d3d9dll, "Direct3DCreate9")
  If *F
    *D3D = CallFunctionFast(*F, #D3D_SDK_VERSION)
  EndIf
Else
  ProcedureReturn #false
EndIf
It works now ;)
Good programmers don't comment their code. It was hard to write, should be hard to read.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

hmm thats one way but what about the .lib files can't they be used in some way?
~Dreglor
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

The .lib are used at linking stage and could be necessary if you work with the .pbl.

Just use PB's DLL-Importer to generate the corresponding PB-libraries.


BTW: I looked at it again, one lib is called d3dx9d.lib. Note: This is the debug
version, the release-version is static and doesn't need the dll.
So, if you decide to use it, you should replace the lib with the release version
of it as no ordinary user has the d3dx9d.dll. The lib comes with the SDK.
Good programmers don't comment their code. It was hard to write, should be hard to read.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

im now trying to do it from the directx sdk pack since the dx pack isn't helping much
noticed that the directx sdk has no dlls in it
just libs what im trying to figure out is how to define functions becasue i can't see much in the headers that point to such functions
~Dreglor
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

Dreglor wrote:noticed that the directx sdk has no dlls in it
just libs
You can install DirectX from the /Redist/ directory, what other dlls do you need?
Dreglor wrote: what im trying to figure out is how to define functions becasue i can't see much in the headers that point to such functions
What's your problem exactly?

Remember, DX is COM based. The necessary interfaces have already
been converted and come with every installation of PureBasic.

You already know how to initialize DX (see the DX-pack example).
This is the only 'real' function you have to call.
Good programmers don't comment their code. It was hard to write, should be hard to read.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

yeah but for some reason the d3d.dll only has one function and the debug has a whole bunch more strange
also the vertex shader example in the dx pack requires the other dll
~Dreglor
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

Dreglor wrote:yeah but for some reason the d3d.dll only has one function and the debug has a whole bunch more strange
also the vertex shader example in the dx pack requires the other dll
That's because D3DX is a static library, if you want to use D3DX-functions dynamically
you have to use the debug version instead (see my other post). Understand D3DX
as an addon to D3D, written to make life easier. This has nothing do to with the core
functionality of D3D.
Good programmers don't comment their code. It was hard to write, should be hard to read.
Post Reply