switch between full and windowed 3D screen

Just starting out? Need help? Post your questions and find answers here.
User avatar
Psychophanta
Addict
Addict
Posts: 4996
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

switch between full and windowed 3D screen

Post by Psychophanta »

I have a tip to switch between standard 2D graphics full screen to windowed one, and viceversa and it works nicely.
But when try to do it using Engine3D, then it does not work.
Is there a way to do it for 3D screen ?

Code: Select all

Macro initsprograma()
  CreateLight(0,$EEEEEE,4,4,2,#PB_Light_Point)
  CreateCamera(0,0,0,100,100)
  MoveCamera(0,0,0,3,#PB_Absolute)
  LoadTexture(0,"soil_wall.jpg")
  CreateMaterial(0,TextureID(0))
  CreateCube(0,1)
  CreateEntity(0,MeshID(0),MaterialID(0),0,0,0)
EndMacro

If InitEngine3D()=0
  MessageRequester("Error","The 3D Engine can't be initialized",0):End
EndIf
If InitSprite()=0 Or InitKeyboard()=0 Or InitMouse()=0
  MessageRequester("Error","The graphics Engine can't be initialized",0):End
EndIf
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Textures",#PB_3DArchive_FileSystem)

If ExamineDesktops()=0
  MessageRequester("Error","Can not examine desktops",0):End
EndIf
Global pantallacompleta.b=0,bitplanes.a=DesktopDepth(0),FRX.u=DesktopWidth(0),FRY.u=DesktopHeight(0),RX.u,RY.u,FrecuenciadeMuestreo.u=60
If FRX<1280 Or FRY<720:RX=FRX*2/3:RY=FRY*2/3:Else:RX=1280:RY=720:EndIf
OpenWindow(0,0,0,RX,RY,"switch screen size",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
initsprograma()

Macro cambiarpantalla()
  CloseScreen()
  If IsWindow(0):CloseWindow(0):EndIf
  pantallacompleta.b!1
  If pantallacompleta.b
    RX=FRX:RY=FRY
    OpenScreen(RX,RY,bitplanes.a,"cuerpo TID",#PB_Screen_WaitSynchronization,FrecuenciadeMuestreo.u)
  Else
    If FRX<1280 Or FRY<720:RX=FRX*2/3:RY=FRY*2/3:Else:RX=1280:RY=720:EndIf
    OpenWindow(0,0,0,RX,RY,"switch screen size",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
    OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
  EndIf
  initsprograma()
EndMacro

Repeat
  ExamineKeyboard()
  If pantallacompleta.b=0
    WaitWindowEvent()
  EndIf
  RenderWorld()
  FlipBuffers()
  If KeyboardReleased(#PB_Key_C)
    cambiarpantalla()
  EndIf
Until KeyboardPushed(#PB_Key_Escape)
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
Psychophanta
Addict
Addict
Posts: 4996
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: switch between full and windowed 3D screen

Post by Psychophanta »

The issue continues in the PB 6.03b6 win64. :(
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
Post Reply