; HttpProgress Example ; -------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,0,-3 light=CreateLight() RotateEntity light,45,45,0 ; A 3.7 MB glTF model from the Khronos Group's samples on GitHub url$="https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/DamagedHelmet/glTF-Binary/DamagedHelmet.glb" file$=SystemProperty("tempdir")+"DamagedHelmet.glb" ; Download it into a file, which appears once the whole answer is in request=HttpRequest(url,"GET","","",file) helmet=0 While Not KeyDown(1) ; When the download ends well, load the model it saved If helmet=0 And HttpStatus(request)=200 Then helmet=LoadMesh(file) EndIf If helmet Then TurnEntity helmet,0,0.5,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld ; HttpProgress goes from 0 to 1 as the answer arrives progress#=HttpProgress(request) Rect 20,440,600,20,False Rect 20,440,600*progress,20,True Text 0,0,"Arrow keys: move camera Esc: exit" Text 0,20,"HttpProgress(request) = "+progress If HttpStatus(request)<0 Then Text 0,40,"No answer: "+HttpError(request) Flip Wend ; Stop the download if it still runs, and tidy up its file FreeHttpRequest request DeleteFile file End