Page 8 of 24
Posted: Mon Jan 12, 2009 2:14 am
by ale870
I think I found another problem: it seems the function
dbPhySetAutoFixedTiming() but general movement seems acting slowly, like a "slow-motion" effect.
Gravity seems set as if I were on the moon
Please give me a feedback about it.
NOTE: I made the following function as a workaround to
sync rate issue (and it works very well):
Code: Select all
Repeat
QueryPerformanceCounter_(@counter)
millisecs = ( (counter - oldCounter) / freq )
Delay(0)
Until millisecs >= 0.0166667
Setup, before main loop isthe following:
Code: Select all
Global counter.q
Global oldCounter.q
Global freq.q
Global millisecs.f
QueryPerformanceFrequency_(@freq)
Thank you.
Posted: Mon Jan 12, 2009 2:23 am
by Mistrel
Are you certain that the Dark Physics issue is related to PureGDK?
Posted: Mon Jan 12, 2009 7:44 am
by ale870
I think so, since I made a test on an existing demo in DBPro (there is a demo just to show this feature: apply physics even with different frame rates) and it seems it works,.
I don't know if there could be problems related to DLL version (maybe DBPro uses updated DLL?), or similar.
If you can, check DBPro example in "DarkPhysics" folder. There is a demo for frame rate test.
If you want I can send you my texst, source code included, and you can use it to make some tests.
Please let me know,
Thank you!
Posted: Mon Jan 12, 2009 8:06 am
by Mistrel
That would be find but I don't need it right this minute. Now that the compiler is done I need to go back and cleanup all of the little things I have here in a list. Then I'll recompile everything for the beta and I'll be ready for more bugs like these.
I'm trying to wrap things up for a beta release before adding new bugs to my list which may have already been fixed.
Posted: Mon Jan 12, 2009 8:52 am
by ale870
Ok, tell me if (and when!) you will be able to check it.
I will keep my demo in case you will need it.
I'll wait for good news
Thank you.
Posted: Mon Jan 12, 2009 10:43 am
by Olby
Very nice to see you Mistrel working heavily on this! I am going to port my engine from DBPro to PureGDK so there should be definitely some real bulletproof test for PureGDK. I will try to report all bugs I encounter with it. But I can only start when I get support for version 7.1 of DBPro as I use some of the features from the latest releases.
Posted: Wed Jan 14, 2009 10:43 pm
by ale870
Hello,
I wish to show you my first advanced terrain + Dark Physics enabled, realized in PureBasic & PureGDK:
The ball is physics enabled.
Thank you Mistrel for your help!
One suggestion: I think you need to open a wiki, so everybody could participate to fill the documentation, send tips & tricks, demos, tutorials, etc...
Posted: Sat Jan 17, 2009 12:22 am
by ale870
Hello,
I need to modify the vertex of a terrain:
Code: Select all
dbMakeObjectTerrain(terrainId)
<more code...>
dbBuildTerrain(terrainId)
I need to change vertex since I need to attach many terrains one near each other. So I need to "align" vertex on the edges (boundaries).
The problem is when I use
dbLockVertexDataForMesh(terrainId) my program crash!
Can you suggest me a way to change vertex?
Thank you!
Posted: Sat Jan 17, 2009 7:49 pm
by Mistrel
A wiki is a good idea but I'm not sure there are enough PureGDK users who will actually take part in a community documentation.
Look at: "dbLockVertexDataForMesh(terrainId)". It requires a mesh ID but you're passing a terrain ID. The crash is probably a DBP crash and not a PureGDK one. Always try using functions like dbMeshExist() to confirm that you're passing the correct type to a function like this.
I'm glad to see you got DarkPhysics and Advanced Terrain to work. What was the problem specifically?
Posted: Sat Jan 17, 2009 7:58 pm
by ale870
Ok, thank you! I didn't see wrong argument parameters. Sorry!
Posted: Sat Jan 17, 2009 9:27 pm
by Olby
Hey Mistrel, how far are you with releasing the latest version of PGDK? I am eagerly waiting to start coding!

Posted: Mon Jan 19, 2009 4:19 am
by Mistrel
I just finished adding all of the new commands introduced by 6.9 and 7.0.
There are also a few tweaks like the mouse button command now supporting 5 buttons instead of 3 and dbMouseX() and dbMouseY() now work outside the bounds of the DBP window.
Posted: Mon Jan 19, 2009 12:31 pm
by ale870
Thank you Mistrel! Updated information are always welcome

Posted: Mon Jan 19, 2009 3:22 pm
by ale870
Hi,
I'm starting to use shaders, but as soon as I use the function
dbSetObjectEffect(terrainId, myEffect) the program crash.
Since I'm new in shaders, and I'm using a pre-made shader, can you help me to find the problem?
This is my code:
Code: Select all
Global myEffect.l = 1
dbLoadEffect("BasicLightMapping.fx", myEffect, 0)
.. load models, and do something else...
If dbEffectExist(myEffect)
dbSetObjectEffect(terrainId, myEffect)
dbTextureObject(terrainId, 0, 100001)
dbTextureObject(terrainId, 1, 100002)
Else
MessageRequester("d", "Error. Cannot load/use the shader.")
EndIf
This is the shader:
Code: Select all
//
// Very basic shader for blending a diffuse texture with ambient light and a
// lightmap written by Green Gandalf 31 March 2007.
//
float4x4 wvp : WorldViewProjection;
float4 ambient = {1.0, 1.0, 1.0, 1.0};
float4 blend1 = {0.3, 0.3, 0.3, 1.0};
float4 blend2 = {0.7, 0.7, 0.7, 1.0};
texture diffuseTex < string ResourceName=""; >;
texture lightMap < string ResourceName=""; >;
sampler2D diffuseSamp = sampler_state { texture = <diffuseTex>; };
sampler2D lightMapSamp = sampler_state { texture = <lightMap>; };
struct VSInput
{ float4 pos : Position;
float2 UV0 : Texcoord0;
float2 UV1 : Texcoord1;
};
struct VSOutput
{ float4 pos : Position;
float2 UV0 : Texcoord0;
float2 UV1 : Texcoord1;
};
struct PSInput
{ float2 UV0 : Texcoord0;
float2 UV1 : Texcoord1;
};
struct PSOutput
{ float4 col : Color;
};
VSOutput VShader(VSInput In, VSOutput Out)
{ Out.pos = mul(In.pos, wvp);
Out.UV0 = In.UV0;
Out.UV1 = In.UV1;
return Out;
}
PSOutput PShader(PSInput In, PSOutput Out)
{ float4 diffuse = tex2D(diffuseSamp, In.UV0);
float4 lighting = tex2D(lightMapSamp, In.UV1);
Out.col = diffuse * (ambient * blend1 + lighting * blend2);
return Out;
}
technique basicLightMap
{ pass p0
{ vertexShader = compile vs_1_1 VShader();
pixelShader = compile ps_1_4 PShader();
}
}
[/code]
Posted: Mon Jan 19, 2009 4:15 pm
by Olby
As it seems you are trying to apply a shader on terrain. And if you used internal terrain generating commands terrains differ from standard objects and thus cannot have effects on them. Best way to achieve this is to use DBO objects instead of internal terrains.