PureGDK - 3D Programming for PureBasic
This kind of feature is a low priority right now but if you can make it work I'll consider adding a dbLockImage/dbUnlockImage which returns a pointer for manipulating an image by its ID.
http://forum.thegamecreators.com/?m=for ... 3&b=18&p=0
The interfaces you need to handle Direct3D are already built into PureBasic. Just assign them to a structure pointer and you're good to go.
http://forum.thegamecreators.com/?m=for ... 3&b=18&p=0
The interfaces you need to handle Direct3D are already built into PureBasic. Just assign them to a structure pointer and you're good to go.
There is no way to do this since it is a DirectX limitation. When the resolution is changed all data must be reloaded into video memory.
PureGDK supports callbacks for D3DDeviceLost and D3DDeviceReset states of the render device so that you can backup any important information and reload it after the device has been reset. This an exclusive feature of PureGDK and is not available in DBP or DarkGDK.
See the 'D3DDevice Callbacks' example on the website.
One thing to take into consideration is that this feature is not supported in debug mode, although that may change in the future.
PureGDK supports callbacks for D3DDeviceLost and D3DDeviceReset states of the render device so that you can backup any important information and reload it after the device has been reset. This an exclusive feature of PureGDK and is not available in DBP or DarkGDK.

See the 'D3DDevice Callbacks' example on the website.
One thing to take into consideration is that this feature is not supported in debug mode, although that may change in the future.
You can't close a window after you open it similar to how you can't close an initialized library or global variable. The window technically exists at all times but it's not initialized and shown until you call that command. The exception to this is debug mode which does not start the DBP process (it runs in parallel) until you open the window.
You can change the resolution at runtime by using dbSetDisplayMode (see the documentaion). If you want to hide the window use the API ShowWindow_ on the DBP hWnd. You can retrieve this handle at any time with the dbGetDBWndHandle command.
If you want to flush data from video memory without changing resolutions use dbFlushVideoMemory.
You can change the resolution at runtime by using dbSetDisplayMode (see the documentaion). If you want to hide the window use the API ShowWindow_ on the DBP hWnd. You can retrieve this handle at any time with the dbGetDBWndHandle command.
If you want to flush data from video memory without changing resolutions use dbFlushVideoMemory.
Hello,
I have a new question:
how can I disable ESC key?
In Dark Basic there is the function disable escapekey but I cannot trap nor disable ESC in PB.
Now as workaround I use F12 key for clean program exit, but if I press ESC I can exit without grabbing the event (I need to close some libraries, kill threads, etc...).
Thank you!
I have a new question:
how can I disable ESC key?
In Dark Basic there is the function disable escapekey but I cannot trap nor disable ESC in PB.
Now as workaround I use F12 key for clean program exit, but if I press ESC I can exit without grabbing the event (I need to close some libraries, kill threads, etc...).
Thank you!
Hello (again!).
I have serious problems using multithread and PureGDK.
I made a lot of tests, and it seems that there are some thread-access conflicts using PureGDK functions. The problem is not solved even using RELASE-MODE (not debug) and using Thread-safe.
Using many threads (5 or 10 or 20 or ...) I often obtain a "error - attempt t read or write to/from an address to which tha tprocess isn't allowed".
I made MANY tests, and I'm sure (almost sure at 99%) is not related to variables, pointers, generic functions, etc...
I cannot publish the source code, since it is enough big.
It seems the problem is in rendering process (inside a thread):
Have you some suggestions/hints for me?
NOTE:
I'm a long-age programmer 
Thank you!
I have serious problems using multithread and PureGDK.
I made a lot of tests, and it seems that there are some thread-access conflicts using PureGDK functions. The problem is not solved even using RELASE-MODE (not debug) and using Thread-safe.
Using many threads (5 or 10 or 20 or ...) I often obtain a "error - attempt t read or write to/from an address to which tha tprocess isn't allowed".
I made MANY tests, and I'm sure (almost sure at 99%) is not related to variables, pointers, generic functions, etc...
I cannot publish the source code, since it is enough big.
It seems the problem is in rendering process (inside a thread):
Code: Select all
Procedure updateMainLoop(Null)
dbDisableEscapeKey()
Repeat
dbText(10, 10, Str(dbScreenFPS()))
dbSync()
doExitFromThread = dbKeyState(88)
Delay(1)
Until doExitFromThread <> 0
EndProcedure
NOTE:
I know how it works, I was jokingTry the search tab in the help file. Searching for "Escape" brings up the correct page in the results.


Thank you!
The current release of PureGDK only supports calling PureGDK functions from a single thread. You can call PureGDK functions from a thread but not from two threads simultaneously. This is also only safe to do with the debugger off.
Threadsafety has been completely re-written for the next version to support calling functions from multiple threads by using a mutex-locked command queue. Calling PureGDK threads will now also work with the debugger on or off.
You can call PureGDK functions from multiple threads now but you will have to use your own mutex lock to prevent access violations.
Threadsafety has been completely re-written for the next version to support calling functions from multiple threads by using a mutex-locked command queue. Calling PureGDK threads will now also work with the debugger on or off.
You can call PureGDK functions from multiple threads now but you will have to use your own mutex lock to prevent access violations.
There is no preview yet but I can promise you that you won't be disappointed. A lot of code has been re-written for speed and stability. There are some fundamental improvements as well, for example, the 3D window now opens as a screen rather than a separate window. This allows you to easily parent it to what ever PB window you want and perform your own message processing.
My favorite feature is certainly the improved support for automatic thread safety. I've worked really hard to make sure it works as well as possible. The thread safety feature is also supported by the plugin framework as well as all native DBP commands.
There have also been some minor tweaks to improve the overall product, courtesy of The Game Creators. PureGDK would not be complete without their support.
I am also implementing support for language packs so that notifications can be translated into other languages. This is also a very important feature for the next release.
My favorite feature is certainly the improved support for automatic thread safety. I've worked really hard to make sure it works as well as possible. The thread safety feature is also supported by the plugin framework as well as all native DBP commands.
There have also been some minor tweaks to improve the overall product, courtesy of The Game Creators. PureGDK would not be complete without their support.
I am also implementing support for language packs so that notifications can be translated into other languages. This is also a very important feature for the next release.