Can a windowed 3D world be resized automatically

Everything related to 3D programming
coco2
Enthusiast
Enthusiast
Posts: 368
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Can a windowed 3D world be resized automatically

Post by coco2 »

I have tried to do this with the following code but it doesn't seem to work. When I try to resize it bigger the black 3D world doesn't seem to stretch.

Code: Select all

Procedure Init()
  If Not InitEngine3D()
    Debug "Could not initialise 3D engine"
    MessageRequester("Error", "Could not initialize 3D engine",0)
    ProcedureReturn 0
  EndIf
  
  InitSprite()
  InitKeyboard()
  InitMouse()  
  
  ExamineDesktops()
  
  DesktopW = DesktopWidth(0)
  DesktopH = DesktopHeight(0)
  
  If Not OpenWindow(0, 0, 0, DesktopW/2, DesktopH/2, "Description", #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
    Debug "Could not initialise window"
    MessageRequester("Error", "Could not initialize window",0)
    ProcedureReturn 0
  EndIf
  
  If Not OpenWindowedScreen(WindowID(0), 0, 0, DesktopW/2, DesktopH/2, #True, 0, 0, #PB_Screen_SmartSynchronization)
    Debug "Could not initialise windowed screen"
    MessageRequester("Error", "Could not initialise windowed screen",0)
    ProcedureReturn 0
  EndIf
  ProcedureReturn 1
EndProcedure

Procedure Main()
  
  Quit = 0
  
  Repeat ; main loop
    
    Repeat ; process all events
      Event = WindowEvent()
      Select Event
        Case #PB_Event_CloseWindow
          Quit = 1
      EndSelect
    Until Event = 0
    
    If MouseControl ; only check mouse if the player is controlling with it
      If ExamineMouse()
        ; do mouse
      EndIf
    EndIf
    
    If ExamineKeyboard()
      ; Do keyboard
    EndIf
    
    RenderWorld()
    FlipBuffers()
    
  Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  
EndProcedure

If Init()
  Main()
EndIf

wombats
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Dec 29, 2011 5:03 pm

Re: Can a windowed 3D world be resized automatically

Post by wombats »

It didn't work for me in my own code. It's disappointing, for sure. There have been numerous posts about it, and I haven't come across any official word on the matter.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: Can a windowed 3D world be resized automatically

Post by Mistrel »

This would require handling the invalid direct3d device callback which I don't think PureBasic supports.
wombats
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Dec 29, 2011 5:03 pm

Re: Can a windowed 3D world be resized automatically

Post by wombats »

Mistrel wrote:This would require handling the invalid direct3d device callback which I don't think PureBasic supports.
That's a shame.

Are you still developing and supporting DarkGDK?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: Can a windowed 3D world be resized automatically

Post by Mistrel »

wombats wrote:Are you still developing and supporting DarkGDK?
I still support it but it never gained much traction as a product so I don't spend much time improving it. It's been stable for years and I still use it as my go-to for adding any kind of 3D to my projects while using PureBasic.

The website is still available and the product comes with an SDK. You're welcome to try it if you like.

Also; yes. DarkGDK 2.0 supports D3D callbacks for DeviceLost/DeviceNotReset/DeviceReset. ;)
Post Reply