Page 9 of 24
Posted: Mon Jan 19, 2009 4:20 pm
by ale870
Bsically I'm creating a terrain, but I'm creating a terrain using standard .X model. See here:
Code: Select all
dbLoadObject("terrenoA2.x", terrainId, 4)
dbScaleObject(terrainId, 50, 50, 50 )
dbPositionObject(terrainId, 0, 0, 0)
dbLoadImage("terrenoA.bmp", 100001)
dbLoadImage("detail.tga", 100002)
dbPhyMakeRigidBodyStaticMesh(terrainId)
"terrenoA2.x" this is my .x model. I simply use it in dark physics as static mesh.
Another small question: is there any differenct beteen "object" and "mesh" in DBPro? Is it possible that I'm working with objects instead I had to work with mesh?
NOTE:
terrainId is only a variable, that refers to a .x object.
Thank you!
Posted: Mon Jan 19, 2009 6:16 pm
by Mistrel
I'm not sure why it's crashing. There may be a bug there somewhere either in PureGDK in your code. The quickest way is to narrow it down to a test case and try it in DBP. If you can confirm it's PureGDK and provide a bug report I will fix it.
Just as an FYI if you're using plugins, this bug was fixed for PureGDK 1.1 so watch out:
Fixed a bug in GDKLib Builder.exe where it would build the function incorrectly if it returned a value and had only one parameter.
Posted: Mon Jan 19, 2009 6:22 pm
by Olby
Difference between meshes and objects in DBPro is that meshes only contain vertex data (wireframe object), while objects on the other hand contain vertexes, faces, materials & animation. Basically mesh is only bare essentials of a model but object is final product ready to be loaded and worked with.
Posted: Mon Jan 19, 2009 6:26 pm
by Mistrel
Meshes do not contain additional object information like animation. Like Olby said, it's the bare minimum of an object. It's small enough that you can actually parse it and manipulate easily by getting a pointer to it with the memblock commands.
I did a quick check and don't see anything suspicious with dbSetObjectEffect(). I don't think this is the problem.
Posted: Mon Jan 19, 2009 7:17 pm
by ale870
Ok, thank you.
I will try to make a small similar program in Dark basic, and I will give you the results.
Thanks for info about object and mesh. One question: can I use mesh for dark physics? Do I get any advantages in this way (I think so, since memory and CPU cycles could get benefits for this)?
Posted: Mon Jan 19, 2009 7:19 pm
by Mistrel
You have to pass the correct parameter to whatever function you're calling. Consult the documentation and match that.
Posted: Mon Jan 19, 2009 10:16 pm
by ale870
Hello,
you are right Mistrel. I made a test in DBPro and the problem persists.
More: If I apply the shader to a simple cube, with the same textures and shader effect, it works.
So the problem is related to ".x" management, or related to the model self.
Thank you.
Posted: Mon Jan 19, 2009 10:19 pm
by Mistrel
If this is truly a DBP bug please post a report on the TGC forums. I'll be looking for your test-case so I can know what to avoid myself.

Posted: Mon Jan 19, 2009 10:23 pm
by ale870
This is the code in DBPro I made as test:
Code: Select all
cd "C:\temp\terrain puregdk\media1"
rem ----------------------------------------------------------------------------------------
myEffect = 1
textureDetail = 2
terrainId = 3
rem ----------------------------------------------------------------------------------------
rem Load all media for game
gosub _load_game
rem Setup all objects for game
gosub _setup_game
rem ----------------------------------------------------------------------------------------
do
CONTROL CAMERA USING ARROWKEYS 0, 3, 2
rem Update screen
sync
loop
rem ----------------------------------------------------------------------------------------
_load_game:
Load Effect "BasicLightMapping.fx", myEffect, 1
Load Image "detail2.bmp", textureDetail
Load Object "geo_2048\terrenoA2.x", terrainId, 2
Scale Object terrainId, 50, 50, 50
Position Object terrainId, 0, 0, 0
set object light terrainId, 1
set object ambient terrainId, 1
Load Image "geo_2048\terrenoA.bmp", 100001
Load Image "detail.tga", 100002
make object cube 22, 100
position object 22, 0, 50, 50
Texture Object 22, 0, 100001
Texture Object 22, 1, 100002
Set Object Effect 22, myEffect
return
rem ----------------------------------------------------------------------------------------
_setup_game:
Autocam Off
Set Camera Range 0.5, 30000
HIDE LIGHT 0
Set Ambient Light 100
color ambient light rgb(255, 255, 255)
color backdrop rgb(0, 0, 200)
sync on : sync rate 60
POSITION CAMERA 0, 100, 0
hide mouse
return
In this case I applied shader to a cube. I don't want to discuss about shader details (someone gave me that, but I think it does not work well... however...).
Terrain.x was created using Geoscape.
If you need more info please don't hesitate to contact me.
I don't want to submit this as bug, since I'm not so experienced in DBPro, so maybe I'm wrong somewhere.
Thank you

Posted: Mon Jan 19, 2009 10:29 pm
by Mistrel
This is not a repeatable bug because you did not include the media required to compile. You need to provide a complete example otherwise it won't get fixed.
Posted: Mon Jan 19, 2009 10:42 pm
by ale870
Yes, you are right.
Here a zip file containing everything to make the test.
http://www.mediafire.com/download.php?zjumtykigyw
Posted: Tue Jan 20, 2009 10:09 pm
by Mistrel
Just to let you guys know the beta is almost ready. I'm out of time this week but I expect to be able to compile an installer and update the PureGDK website with the new build later this week. The beta will be open for everyone so you don't need an account to try it out.
Here is the changelog, still subject to change:
(ChangeLog removed. See official release information on page 10)
Here is an example of the new syntax for opening the DBP screen:
Code: Select all
; Open a PureBasic window
OpenWindow(0,0,0,640,480,"DarkBasic Professional - PureGDK",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
; Initialize the PureGDK screen as a child of window ID 0
hDBWnd=OpenDBWnd(WindowID(0),0,0,640,480)
; Set the sync rate
dbSyncRate(60)
dbMakeObjectCube(1,3)
; Rotate the cube and update the screen
Repeat
x.f+0.2: y.f+0.4: z.f+0.8
dbRotateObject(1,x.f,y.f,z.f)
dbSync()
Until WaitWindowEvent(1)=#PB_Event_CloseWindow
Yes, dbSyncRate does work.
A simple changelog does not do justice the amount of work that's gone into rebuilding PureGDK into a much better product. I hope you'll pick up on some of the changes, most notably the error handler, threadsafety, and the new compiler. I'm very happy with all of the changes and hope to get this into your hands very soon!
Some things still on the TODO list:
** Add new commands to the help file.
** Add a new command SetDBWinCallback to allow subclassing the DBP window with the debugger on.
** New, faster math functions (this is tentative).
** Rewrite the GDK framework documentation to include the new .gdt files and syntax.
** One more compiler optimization that should speed up compiling a little bit more.
Posted: Tue Jan 20, 2009 10:15 pm
by ale870
Wow! You made a huge job!
I will start to work/test new system as soon as you will put it online!
Thank you Mistrel!
Posted: Wed Jan 21, 2009 12:13 am
by Olby
Aww man you rock! I am all pumped up and ready to check how well this all works.
Posted: Wed Jan 21, 2009 9:52 pm
by ale870
Mistrel, one question:
I noticed that DarkPhysics is not thread-safe (I'm making some physics update in a separated thread), and my program crash when I recall dbPhyUpdate()
Can you tell me if next PureGDK version support thread-safe implementation in Dark Physics?
Thank you.