Hello,
I have this program just really for loading models. The first time I launch it in fullscreen it works great. I press escape and it closes and goes back to the IDE. IF I launch again, the model shows up, un-animating this time, there is no text on the screen. If I wait for a minute or 2 the text will show up. The program runs real slow the second time around. Like some dx devices didnt get released the first time after closing the program? A major memory leak? or just bad code?
Oh yeah, the program runs fine in window mode. It never happens in window mode.
Any help would be greatly appreciated!
I have this program just really for loading models. The first time I launch it in fullscreen it works great. I press escape and it closes and goes back to the IDE. IF I launch again, the model shows up, un-animating this time, there is no text on the screen. If I wait for a minute or 2 the text will show up. The program runs real slow the second time around. Like some dx devices didnt get released the first time after closing the program? A major memory leak? or just bad code?
Oh yeah, the program runs fine in window mode. It never happens in window mode.
Any help would be greatly appreciated!
Global ScreenW = 1280 Global ScreenH = 960 Graphics3D ScreenW,ScreenH,32,0 SetBuffer BackBuffer() AmbientLight 120,120,90 ;-------------FPS Stuff-------------------- WireFrame 0 AntiAlias 0 SeedRnd MilliSecs() Global frame_count% Global fps% Global slowest_fps% Global fps_timeout% Global frame_time% Global slowest_frame% Global frame_start% fps_timer = CreateTimer(60) ; Lock to 60FPS. slowmo% = False wiref% = False ;--------------end FPS Stuff---------------- ;--------------KeyPress Stuff--------------- Include "C:\Program Files\Blitz3D\MyProjects\KeyPress\KeyPress.bb" ;--------------End KeyPress Stuff----------- Global mesh_3ds=LoadAnimMesh( "C:\The Docs\3d Modeling and Games\My Stuff\Models\Human Male\Male B\688 Poly\Animations\MaleWalk_Forward2.b3d" ) ;anim seq 0 ;RotateEntity mesh_3ds,0,180,0 PositionEntity mesh_3ds,-15,-15,0 Global mesh_Shirt1=LoadAnimMesh( "C:\The Docs\3d Modeling and Games\My Stuff\Models\Human Male\Male B\688 Poly\Clothing\Shirt.b3d" ) ;anim seq 0 ;RotateEntity mesh_Shirt1,0,180,0 PositionEntity mesh_Shirt1,-15,-15,0 pivot=CreatePivot() Global cam=CreateCamera( pivot ) PositionEntity cam,0,234,-300 PointEntity cam, mesh_3ds lit=CreateLight() RotateEntity lit,45,45,0 DressAnimMesh(mesh_3ds,mesh_shirt1) Animate mesh_3ds,1 trans=10 ;----------------------------------------------------------------------------------------------------------------Main Loop While Not KeyHit(1) ;-------------FPS Stuff-------------------- frame_start = MilliSecs() ; Press ENTER to toggle slow motion. If KeyHit(28) Then slowmo = Not slowmo ; Press BACKSPACE To toggle WireFrame. If KeyHit(14) Then wiref = Not wiref : WireFrame wiref ;--------------end FPS Stuff---------------- If KeyHit(57) If trans > 0 trans=10-1 If trans = 0 trans = 10 EndIf If KeyDown(27) If AnimSeq(mesh_3ds)=0 Animate mesh_3ds,1,.5,1,trans Else If AnimSeq(mesh_3ds)=1 Animate mesh_3ds,2,1,0,trans EndIf If KeyDown(30) MoveEntity cam,0,0,10 EndIf If KeyDown(44) MoveEntity cam,0,0,-10 EndIf If KeyDown(203) TurnEntity pivot,0,3,0 EndIf If KeyDown(205) TurnEntity pivot,0,-3,0 EndIf GetKeyName() UpdateWorld RenderWorld ;-------------FPS Stuff-------------------- frame_time = MilliSecs() - frame_start show_info() WaitTimer(fps_timer) ;Flip True Flip ;Flip False ;Does not run Vsync, shows full FPS ;VWait : Flip False If slowmo Then Delay 200 ;--------------end FPS Stuff---------------- Wend End ;----------------------------------------------------------------------------------------------------------------End Main Loop ;----------------------------------------------------------------------------------------------------------------show_info Func Function show_info() If fps_timeout frame_count = frame_count + 1 If MilliSecs() > fps_timeout Then fps_timeout = MilliSecs() + 1000 fps = frame_count frame_count = 0 If fps < slowest_fps Or slowest_fps = 0 Then slowest_fps = fps EndIf If frame_time > slowest_frame Then slowest_frame = frame_time Color 0,255,0 Text 10,10," Triangles: " + TrisRendered() Color 255,255,0 Text 10,25," Millisecs: " + frame_time Text 10,40," Slowest: " + slowest_frame Color 0,255,255 Text 10,55," FPS: " + fps Text 10,70," Worst: " + slowest_fps Color 255,255,255 Text 10,85,"Anim len: "+AnimLength( mesh_3ds ) Text 10,100,"Anim time:"+AnimTime( mesh_3ds ) Text 10,115,"Transition time="+trans Text 10,130,"KeyName = "+KeyName$ Text 10,145,"Entity Coords = "+EntityX(cam,True)+", "+EntityY(cam,True)+", "+EntityZ(cam,True) Else ; First call initialization. fps_timeout = MilliSecs() + 1000 EndIf End Function ;----------------------------------------------------------------------------------------------------------------End show_Info Func