sorry but i had a lag myself. try this code:
Graphics3D(640,480,0,2)
SetBuffer(BackBuffer())
c = CreateCamera()
PositionEntity(c, 0,0,-2)
CameraRange(c, .1,5)
s = CreateSphere(64)
EntityPickMode(s, 2)
s1 = CreateSphere(2)
EntityColor(s1, 255,0,0)
ScaleEntity(s1, .1,.1,.1)
s2 = CreateSphere(2)
EntityColor(s2, 0,255,0)
ScaleEntity(s2, .1,.1,.1)
While Not KeyHit(1)
t = MilliSecs()
CameraPick(c, MouseX(), MouseY())
PositionEntity(s1, PickedX(), PickedY(), PickedZ())
PositionEntity(s2, (MouseX() - 320)/640.0 * 2, -(MouseY() - 240)/480.0 * 2, -1)
If MouseHit(1)
DebugLog "***********************************"
DebugLog "before creation " + (MilliSecs()-t)
FreeEntity(s)
s = CreateSphere(64)
DebugLog "after creation " + (MilliSecs()-t)
EntityPickMode(s, 2)
EndIf
RenderWorld()
DebugLog "after renderworld " + (MilliSecs()-t)
Flip()
Wend
End
if you click you'll see something like this in your debugwindow:
***********************************
before creation 1
after creation 11
after renderworld 14
after renderworld 173
after renderworld 2
after renderworld 5
after renderworld 2
so the frame
after the rebuild of the mesh suddenly takes 173 milliseconds. why?