Engine3d and Autosize ?

Advanced game related topics
dontmailme
Enthusiast
Enthusiast
Posts: 537
Joined: Wed Oct 29, 2003 10:35 am

Engine3d and Autosize ?

Post by dontmailme »

Before I have no hair left.... can someone confirm my conclusion that if you have an autostretch windowed screen and then use the 3d engine with it, the autostretch stops working....

In fact it seems the screen output halts completely if you resize the screen to anything larger than what it was originally!

If this is correct, then why does the DX screen 'freeze' ? and why can't we use autostretch with the 3d engine ?

Code is the entity.pb code modified to only run in window, autostretch, and with resize capability....

Nb.... This is using Windows 4.10b2 ;)

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Entity
;
;    (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;

IncludeFile "Screen3DRequester.pb"

Define.f KeyX, KeyY, MouseX, MouseY

  
If InitEngine3D()

  Add3DArchive("Data\"          , #PB_3DArchive_FileSystem)
  Add3DArchive("Data\Skybox.zip", #PB_3DArchive_Zip)
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  OpenWindow(1,0,0,1024,768,"TEST",#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_SystemMenu)
  
  If OpenWindowedScreen(WindowID(1), 0,0,1024,768,1,0,0)
    
    LoadMesh   (0, "Robot.mesh")
    
    CreateMaterial(0, LoadTexture(0, "clouds.jpg"))
    CreateMaterial(1, LoadTexture(1, "r2skin.jpg"))
    
    CreateEntity(0, MeshID(0), MaterialID(0))
    ;CreateEntity(1, MeshID(0), MaterialID(1), -60, 0, 0)
    ;CreateEntity(2, MeshID(0), MaterialID(1),  60, 0, 0)
    
    ;AnimateEntity(0, "Walk")
    
    ;SkyBox("desert07.jpg")
   
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0,0,0,150)
      
    CameraLookAt(0, 0, 0, 0)  
      
    
      
    Repeat
    a=0
    b=0
    For c=0 To 359
    
      Screen3DEvents()
      
      
      
      ClearScreen(RGB(0, 0, 0))
            
            
      
      RotateEntity(0, 0, 90, c)
      
      
      
      
      
      RenderWorld()
      Screen3DStats()
      FlipBuffers()
   
   Next   
     
     ExamineKeyboard() 
      
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
    
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
  
End
***EDIT***

Just wanted to add that I'm asking because I am coding a game which runs in 2d.... with a set screen resolution that will autostretch.... I've added a 3d view to this game and now the autostretch doesn't work any more.

So another question would be... If 3d does disable autostretch, then how do I switch from 2d to 3d and back again ? Which commands cause the autostretch to disable, so I can separate them from the 2d display!

Hope someone can help :D
Paid up PB User !
citystate
Enthusiast
Enthusiast
Posts: 638
Joined: Sun Feb 12, 2006 10:06 pm

Post by citystate »

when you get a resize window event, you could free the camera, recalculate the dimensions then create a new camera
there is no sig, only zuul (and the following disclaimer)

WARNING: may be talking out of his hat
Post Reply