3d resizing aspect ratio
Posted: Thu Dec 12, 2024 1:37 pm
We can now resize 3d windows, which is great!
I was wondering if the aspect ratio can be controlled without letterboxing the camera?
Code show the aspect ratio squishing the viewport when the window is resized.
I was wondering if the aspect ratio can be controlled without letterboxing the camera?
Code show the aspect ratio squishing the viewport when the window is resized.
Code: Select all
Procedure SizeWindow()
RenderWorld()
FlipBuffers()
EndProcedure
If InitEngine3D()=0 Or InitSprite() = 0
MessageRequester("Error", "Error with InitEngine3D!", 0)
End
EndIf
If OpenWindow(0, 0, 0, 800, 600, "Aspect Ratio Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
OpenWindowedScreen(WindowID(0), 0, 0, 800,600,1, 0, 0, 0)
EndIf
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,150 ,-15, #PB_Absolute)
CameraLookAt(0,0,0,0)
BindEvent(#PB_Event_SizeWindow, @SizeWindow())
CreateIcoSphere(0,25,3)
CreateEntity(0,MeshID(0),0,50,0,0)
CreateCube(1,25)
CreateEntity(1,MeshID(1),0,-50,0,0)
CameraBackColor(0 , RGB(120,20,20))
Light1=CreateLight(#PB_Any, RGB(25, 25, 180), -500, 200, 199, #PB_Light_Point)
Light2=CreateLight(#PB_Any, RGB(180, 25, 25), 500, 200, 199, #PB_Light_Point)
Light3=CreateLight(#PB_Any, RGB(25, 180, 25), 0, -500, 0, #PB_Light_Point)
Repeat
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
EndSelect
Until Event = 0
RenderWorld()
FlipBuffers()
Delay(1)
ForEver