PureGDK - 3D Programming for PureBasic

Developed or developing a new product in PureBasic? Tell the world about it.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I'm going to wait another one or two weeks to give people a chance to work with this beta. Then all beta testing for PureGDK 1.1 will be done. :)
silentworks
User
User
Posts: 23
Joined: Fri Aug 29, 2008 5:15 pm
Location: Hungary, Budapest
Contact:

dbFlushLightMaps() error

Post by silentworks »

Matt,

dbFlushLightMaps() gives me an error "Couln't find library function. Please report this is a bug."

Thanks,
Zoltan
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

This is actually a bug in DBProGameFX.dll. The string table entry is missing for this function. But you did find a typo in the error. Thanks for that. :)

I submitted a bug report for this on TGC forum:
http://forum.thegamecreators.com/?m=for ... 46879&b=15
silentworks
User
User
Posts: 23
Joined: Fri Aug 29, 2008 5:15 pm
Location: Hungary, Budapest
Contact:

Post by silentworks »

It is funny, I made the same mistake when I typed the error message here. :D


edit: ... and made another one also...
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I would like to thank everyone who participated in the PureGDK 1.1 beta. There were a lot of great reports and feedback that really helped through its development.

The official release will be available shortly to registered users on PureGDK.com. I expect The Game Creators will update their store within the next few days.

I'll let everyone know here when it's uploaded and ready. :)
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

It's out! As a special thank-you to everyone who participated as a beta tester, PureGDK is being discounted starting today until Tuesday of next week (March 24).

Existing users who purchased from PureGDK.com can log into their account immediately and download the official release. New users can purchase a copy from the order page here:

http://puregdk.com/index.php?f=purchase

Users who purchased through The Game Creators store will have to wait until links are updated by The Game Creators. I'll make an announcement when I have more information.

There have been a lot of changes and improvements! For those who are unfamiliar with what's different in the new version, here are the complete release notes since PureGDK 1.0.3:
PureGDK 1.1.0
====================

DarkBasic Professional 7.2 is the version officially supported by this release of PureGDK.

Bug fixes:
- Fixed a bug where dbLoadMusic failed to return an ID with the debugger was off when passed #PB_Any.

Updates:
- Removed legacy code from dbLoadAnimation, dbLoadEffect, and dbLoadMusic. This will increase their responsiveness in tight loops with the debugger off.
- Updated the PureGDK framework library documentation.


PureGDK 1.1.0 Beta 4
====================

Bug fixes:
- Updated the uninstaller to be compatible with PureBasic 4.30.


PureGDK 1.1.0 Beta 3
====================

Bug fixes:
- Fixed a bug where the PureGDK compiler would display both the GUI and the command-line window at the same time. The command line window is now hidden when compiling from the IDE as it was intended. This update was missing from 1.1.0 Beta 2.
- Fixed a bug where dbMouseMoveX and dbMouseMoveY calculated the first iteration incorrectly.
- Fixed a bug where the PureGDK compiler would not parse the include keyword correctly if it did not use parenthesis.
- Fixed a bug where the following commands would fail to return a value with the debugger on: dbLightExist, dbLightType, dbLightVisible, dbLightRange, dbLightPositionX, dbLightPositionY, dbLightPositionZ, dbLightDirectionX, dbLightDirectionY, dbLightDirectionZ.
- Removed old debug code in dbSetLightRotationVector that would cause a message box to be appear when called.
- Fixed a bug where dbMouseClick returned the wrong value for the right and middle mouse buttons. The value returned now matches the documentation.
- Fixed a bug where in dbIsIdentityMatrix could fail to recognize a matrix4 structure as an identity matrix.
- Fixed a bug in dbGetCameraPositionVector, dbGetCameraRotationVector, dbGetMatrixPositionVector, dbGetParticlePositionVector, and dbGetParticleRotationVector where they would failed to return the expected value.
- Fixed a bug where dbLoadEffect would cause an access violation error.
- Added all of the new GameFX commands which were missing from PureGDK 1.1.0 Beta 1.
- Added missing help documentation to the System library.
- Fixed a bug where dbTextureScreen only accepted one parameter where it should have accepted two.

Updates:
- Swapped the parameter order of dbCloneSound to be consistent with other commands.
- DBP 7.0 Added new optional parameters to dbLoadEffect and dbSetCameraToImage
- DBP 7.0 Added new commands dbCheckListFValueA, dbCheckListFValueB, dbCheckListFValueC, and dbCheckListFValueD
- Removed the commands dbDisableSystemKeys, dbEnableSystemKeys, dbDisableEscapeKey and dbEnableEscapeKey. This functionality is obsolete in PureGDK 1.1.0 and can be handled through keyboard events.
- Added documentation to the help file for all of the new commands introduced since 6.7.
- Added the library Advanced Terrain to the core libraries. Refer to the documentation for a list of commands.
The following commands will now automatically use and return the next free ID associated with the entity being created when passed an ID of #PB_Any or -1:
* dbLoadAnimation
* dbLoadDVDAnimation
* dbMakeLight
* dbLoadBitmap
* dbCreateBitmap
* dbLoadSound
* dbLoad3DSound
* dbCloneSound
* dbRecordSound
* dbLoadObject
* dbCloneObject
* dbInstanceObject
* dbMakeObject
* dbMakeObjectBox
* dbMakeObjectCone
* dbMakeObjectCube
* dbMakeObjectCylinder
* dbMakeObjectFromLimb
* dbMakeObjectPlain
* dbMakeObjectSphere
* dbMakeObjectTriangle
* dbLoadEffect
* dbLoadVertexShader
* dbLoadPixelShader
* dbLoadMesh
* dbMakeMeshFromObject
* dbLoadImage
* dbGetImage
* dbLoadMusic
* dbMakeMemblock
* dbMakeMemblockFromBitmap
* dbMakeMemblockFromImage
* dbMakeMemblockFromSound
* dbMakeMemblockFromMesh
* dbCopyMemblock
* dbMakeBitmapFromMemblock
* dbMakeImageFromMemblock
* dbMakeSoundFromMemblock
* dbMakeMeshFromMemblock
* dbChangeMeshFromMemblock
* dbMakeParticles
* dbMakeSnowParticles
* dbMakeFireParticles
* dbMakeCamera
* dbMakeMatrix
* dbMakeTerrain
* dbSprite
* dbCreateAnimatedSprite
* dbCloneSprite


PureGDK 1.1.0 Beta 2
====================

Bug fixes:
- Fixed a bug which caused executables to crash when ending the process on Windows Vista.
- Fixed a bug where an access violation would occur in ndb.dll when ending the process if the Newton Game Dynamics library was used.
- Fixed a bug where the PureGDK compiler would display both the GUI and the command-line window at the same time. The command line window is now hidden when compiling from the IDE as it was intended.
- The executable will no longer report an "active functions" notification when terminating on a runtime error if only one active function is locked.

Updates:
- dbKeyState now uses virtual-key codes to prevent scan code conflicts across multilingual keyboards. Please consult the documentation for more information.
- dbGetClipboardData and dbSetClipboard are obsolete and have been removed.
- dbCheckDisplayMode is obsolete. Use EnumDisplaySettings_() instead. Consult the documentation under "From DarkBasic to PureGDK -> Fundamental Differences" for more information on alternative solutions.
- Removed unsupported color depth parameter from dbSetDisplayMode. Use ChangeDisplaySettings_() instead.
- Added new commands from DBP 7.1 dbTextureScreen, dbSetScreenEffect, dbAddMemblockToObject, dbGetMemblockFromObject, and dbDeleteMemblockFromObject.
- Updated the documentation and added example sources to the "From DarkBasic to PureBasic" section of the help file.


PureGDK 1.1.0 Beta 1
====================

DarkBasic Professional 7.1 is the version officially supported by this release of PureGDK.

Bug Fixes:
- Several errors were corrected in the Styx framework library that prevented it from working properly.
- The PureGDK compiler will no longer get stuck due to an infinite include loop.
- Fixed a bug where a PureGDK application would fail to run on certain hardware configurations and crash silently at startup. This affects all previously compiled executables.
- Rewrote the PureGDK's cleanup routines to end more gracefully.
- Fixed a bug in dbHideMouse which caused it to fail.
- Runtime errors caused by PureGDK's internal functions will now call the PureBasic debugger or, if the debugger is off, identify the line number of the offending function in your PureBasic source code.
- Fixed a bug in GDKLib Builder.exe where it would build the function incorrectly if it returned a value and had only one parameter.
- Fixed bugs in various vector functions that caused problems when calling from threads and catching runtime errors.
- Updates have been made to GDKLib Builder.exe to support the new internal threadsafe functions. All third-party libraries must be rebuilt and recompiled using this new version to be compatible with PureGDK.
- Fixed a bug where commands with the parameters SSLL, SSL, and SS that returned a long would crash the executable.
- Fixed a bug where the PureGDK did not end cleanly, causing the PureBasic IDE to continue debugging after the program had already ended.
- Fixed a bug in dbSetObjectToObjectOrientation which caused it to fail. Also added missing parameter and updated documentation.
- dbMouseX() and dbMouseY() now work beyond the extents of the 3D screen. Some code may need to be modified to support the new values which can extend in the negative and positive outside the screen resolution.
- Fixed a bug in SyncRate which caused it to fail.
- Show/hide mouse will no longer lag when entering/exiting the client area of the render window.
- Fixed a bug which caused dbLightExist, dbLightType, and dbLightVisible to fail to return a value with the debugger off.
- Fixed a bug where dbCSGClip would cause the executable to crash.

Updates:
- Removed redundant dbMessage command.
- The PureGDK functions for handling errors have changed. Please consult the 'How to... -> Reference Manual -> PureGDK' section of the documentation to see a list of revised commands.
- Most input commands for the keyboard and mouse are no longer limited to the client area of the render window. Some code may require changes to support this behavior.
- dbScanCode() is obsolete and has been removed. Use GetKeyState_() and MapVirtualKeyEx_() instead to obtain multiple scancodes asynchronously.
- dbCLS2 (Basic2D) has been renamed to dbCLSFill to prevent cross-library include conflicts with dbCLS from DBProCore.dll.
- PureGDK now supports changing the mouse using the SetCursor function of the Win32 API.
- The command dbSyncDelay has been removed to facilitate the changes made to OpenDBWnd which now require use of PureBasic's window event functions.
- Added missing command dbSetObjectMask
- DBP 6.9 Added new optional parameters to dbSetDisplayMode and dbCheckDisplayMode.
- DBP 6.9 Added new stereoscopic command dbSetCamerasStereoscopic.
- DBP 7.0 Added additional parameter Orientation to dbMakeObjectPlain
- DBP 7.0 Removed the obsolete commands dbTextureBackdrop and dbScrollBackdrop
- The compiler has been completely re-written and now includes a compile-time GUI
- Updated Newton Game Dynamics plugin commands for consistency where those that were preceded by NDB_Newton now begin with just NDB_
- DBP Added additional parameter SilentFail to dbLoadSound and dbLoad3DSound
- All PureGDK commands now use the same threadsafety code. Previously commands were only threadsafe while the debugger was off when compiling to a threadsafe executable.
- Added a new function dbGetActiveFunctions which will return the sum of all PureGDK functions currently waiting in queue. This is useful for debugging threadsafe executables that use PureGDK commands.
- Sounds are now loaded with the global flag set. This allows sounds to be played while the render window is a child of another window or changes parents during runtime. Unlike DBP's native command, this flag is not optional in PureGDK.
- Added mouse button 5 to dbMouseClick().
- dbSync functionality has been restored. It previously used only FastSync internally. Each Sync type should now function as expected.
- PureGDK no longer supports automatic thread cleanup. You must end all of your threads before ending the program or it will crash on exit. Additionally, exiting from within a user-defined thread is not supported by PureBasic and will also crash your executable.
- The following commands have been moved to the GameFX library:
* dbSetGlobalShadowsOn
* dbSetGlobalShadowsOff
* dbSetGlobalShadowColor
* dbSetShadowShades
* dbSetShadowPosition
* dbPerformCSGUnion
* dbPerformCSGDifference
* dbPerformCSGIntersection
* dbPerformCSGClip
- Revised command names (Commands moved to GameFX library included):
* dbPerformCSGUnion -> dbCSGUnion
* dbPerformCSGDifference -> dbCSGDifference
* dbPerformCSGIntersection -> dbCSGIntersection
* dbPerformCSGClip -> dbCSGClip
* dbPerformCSGUnionOnVertexData -> dbCSGUnionOnVertexData
* dbPerformCSGDifferenceOnVertexData -> dbCSGDifferenceOnVertexData
* dbPerformCSGIntersectionOnVertexData -> dbCSGIntersectionOnVertexData
* dbPerformCSGUnionOnVertexData -> dbCSGUnionOnVertexData
* dbPerformCSGDifferenceOnVertexData -> dbCSGDifferenceOnVertexData
* dbPerformCSGIntersectionOnVertexData -> dbCSGIntersectionOnVertexData
- New commands added for DBP 7.0
* dbMakeStaticObject
* dbMakeStaticLimb
* dbDeleteStaticObjects
* dbDeleteStaticObject
* dbSetStaticPortalsOn
* dbSetStaticPortalsOff
* dbBuildStaticPortals
* dbSetStaticObjectsWireframeOn
* dbSetStaticObjectsWireframeOff
* dbStaticLineOfSight
* dbGetStaticCollisionHit
* dbStaticRayCast
* dbStaticVolume
* dbGetStaticCollisionX
* dbGetStaticCollisionY
* dbGetStaticCollisionZ
* dbGetStaticCollisionCount
* dbGetStaticCollisionValue
* dbGetStaticCollisionFloor
* dbAddStaticObjectsToLightMapPool
* dbAddObjectToLightMapPool
* dbAddLightMapLight
* dbCreateLightMapS
* dbAddLimbToLightMapPool
* dbDeleteLightMapLightS
* dbAddStaticScorch
* dbLoadStaticObjects
* dbSetStaticScorch
* dbSetShadowLight
* dbReduceMesh
* dbAttachObjectToStatic
* dbDetachObjectFromStatic
* dbAddLODToObject
* dbSaveStaticObjects
* dbMakeStaticCollisionBox
* dbSetStaticUniverse
* dbFlushLightMaps
* dbCSGUnionOnVertexData
* dbCSGDifferenceOnVertexData
* dbCSGIntersectionOnVertexData

It is highly recommended that projects be recompiled with this update to ensure compatibility across all systems.

All plugins compiled by third-parties that utilized GDKLib Builder.exe should recompile using the new version to ensure that all functions are built properly.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

PureGDK 1.1.0 is now available from The Game Creators website for those who have an account there.
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

Post by AndyMK »

Hi, i bought this library yestarday and i must say its seems very fast. I am having a couple of problems though. sprites wont work with the pb debugger on (dbsprite invalid imageid) and the pb "Import" command wont work with the pb debugger off (syntax error in puregdk compiler) .. i need these to work together. Am i missing something? Thanks. Keep up the good work :)
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I tested the sprite example and everything seems ok. Please provide source code/media for your bugs so I can reproduce them and I'll have a look at it. :)
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

Post by AndyMK »

Hi Mistrel. The code below was taken from your image example.

Code: Select all

Import "bass.lib"  ;If this line is run with the pb debugger off, puregdk complains about an error on line 6 "garbage at end of line"
  ;With PB Debugger on, "Line 6: Invalid name: same as an external command". Does not matter what lib i use.
  
  ; Image Functionality
  ; show the PureGDK render window
  OpenWindow(0, 0, 0, 640, 480, "DarkBasic Professional - PureGDK", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  hDBWnd = OpenDBWnd(WindowID(0), 0, 0, 640, 480)
  
  ; set the current directory
  dbSetDir("media1")
  
  ; Fill screen
  dbLoadImage("image.bmp", 1)
  Debug dbImageExist(1)
  For x = 0 To 10
    For y = 0 To 10
      dbPasteImage(1, x*64, y*64); With PB Debugger on, error, image number illegal, and sometimes invalid memory access (write error at address xxxxx). Seems most commands image related dont work with the debugger on.
    Next y
  Next x
  
  dbSetTextOpaque()
  
  ; Main loop
  Repeat
    
    ; Produce random values
    ImageNumber = Random(10000) + 1
    X = Random(640)
    Y = Random(480)
    X1 = Random(320)
    Y1 = Random(240)
    X2 = X1 + 1 + Random(319)
    Y2 = Y1 + 1 + Random(239)
    
    ; Try each command at random
    If Random(5) = 1
      dbLoadImage("image.bmp", ImageNumber)
      
    EndIf
    If Random(5) = 1
      dbGetImage(ImageNumber, X1, Y1, X2, Y2)
    EndIf
    If dbImageExist(ImageNumber) = 1
      If Random(5) = 1
        dbPasteImage(ImageNumber, X, Y)
      EndIf
      If Random(5) = 1
        dbPasteImage(ImageNumber, X, Y, 1)
      EndIf
    EndIf
    
    ; Display Data
    dbText(0, 0, "IMAGE EXPRESSION DATA")
    dbText(0, 15, "")
    dbText(0, 30, "image:" + Str(ImageNumber))
    dbText(0, 45, "exist:" + Str(dbImageExist(ImageNumber)))
    dbText(0, 60, "fps " + Str(dbScreenFPS()))
    If dbImageExist(ImageNumber) = 1
      dbDeleteImage(ImageNumber)
    EndIf
    
    dbSync()
    
    ; End loop
  Until WindowEvent() = #PB_Event_CloseWindow Or dbKeyState(#VK_ESCAPE)
  End
*edit*

bass.lib can be an empty file, it still gives the same error.
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

Post by AndyMK »

This code causes a link error in the puregdk compiler with debugger off.

Code: Select all

Import "bass.lib"; can be any file, even if it does not exist - same error.
EndImport

If OpenWindow(0, 0, 0, 690, 732, "Eminent Live Test")
hDBWnd = OpenDBWnd(WindowID(0), 0, 0, 690, 732); remove this and the Import function works fine
  Repeat
    Delay(1)
    EventID = WindowEvent()
  Until EventID = #PB_Event_CloseWindow
EndIf
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

This patch reverts some changes that were made for the final release which broke dbLoadMusic, dbLoadImage, dbLoadAnimation, dbLoadDVDAnimation when compiling with the debugger.

Here is a quick update to fix this problem:

http://puregdk.com/files/upload/PureGDK ... patch1.zip

To apply the patch replace PureGDK.dll with this one in your PureGDK application data (specified at installation) compilers\plugins-user folder. It's typically located in "\Documents and Settings\Username\Application Data\PureGDK\plugins-user".
Last edited by Mistrel on Sat Mar 21, 2009 11:06 pm, edited 1 time in total.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

AndyMK wrote:Hi Mistrel. The code below was taken from your image example.

Code: Select all

Import "bass.lib"  ;If this line is run with the pb debugger off, puregdk complains about an error on line 6 "garbage at end of line"
  ;With PB Debugger on, "Line 6: Invalid name: same as an external command". Does not matter what lib i use.
  
..
bass.lib can be an empty file, it still gives the same error.
PureGDK isn't providing any useful information here or pointing to the correct line, but you're experiencing a problem here because of a missing EndImport. The second error "Invalid name: same as an external command" is correct. I couldn't reproduce the "Garbage at end of line" one.
AndyMK wrote:This code causes a link error in the puregdk compiler with debugger off.

Code: Select all

Import "bass.lib"; can be any file, even if it does not exist - same error.
EndImport

If OpenWindow(0, 0, 0, 690, 732, "Eminent Live Test")
hDBWnd = OpenDBWnd(WindowID(0), 0, 0, 690, 732); remove this and the Import function works fine
  Repeat
    Delay(1)
    EventID = WindowEvent()
  Until EventID = #PB_Event_CloseWindow
EndIf
I think you're genuinely missing the file or the lib is corrupt. Try replacing bass.lib with window.lib (PureBasic knows where this is) and you'll see that it compiles fine with with the debugger on/off. Also, try working with the .lib in PureBasic without PureGDK and see if you get the same problem.

In this case the PureGDK compiler is not providing the correct error. "Linker Error" isn't very helpful at all. :)
AndyMK wrote:I am having a couple of problems though. sprites wont work with the pb debugger on (dbsprite invalid imageid) ..
This should be fixed with the patch I my previous post. The problem was in dbLoadImage. The image was invalid in this case.
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

Post by AndyMK »

Ok you are right about the lib being the problem but here is something strange. I ran a few tests.

import window.lib - pb only commands debugger on and off - WORKS

import window.lib - pb+OpenDBWnd() commands debugger on and off - WORKS

import bass.lib - pb only commands debugger on and off - WORKS

import bass.lib - pb+OpenDBWnd() commands debugger on - WORKS

import bass.lib - pb+OpenDBWnd() commands debugger off - LINKER ERROR


Thanks for the new patch :)

The link is broken :(
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

AndyMK wrote:Ok you are right about the lib being the problem but here is something strange. I ran a few tests.

import window.lib - pb only commands debugger on and off - WORKS

import window.lib - pb+OpenDBWnd() commands debugger on and off - WORKS

import bass.lib - pb only commands debugger on and off - WORKS

import bass.lib - pb+OpenDBWnd() commands debugger on - WORKS

import bass.lib - pb+OpenDBWnd() commands debugger off - LINKER ERROR


Thanks for the new patch :)

The link is broken :(
Fixed a typo in the link for the patch. It should work now.

Please provide a simple example to demonstrate the bug with any necessary files so I can test it exactly how you're experiencing it.
Post Reply