Issue with Orthographic View.
Posted: Sun Aug 18, 2013 7:36 pm
If you switch the camera to Orthographic Mode. Then try moving the camera forward you get a weird effect. Maybe, this is normal, but I kinda think it's not supposed to happen.
If you zoom in. Your camera will stay in one place, but the mesh will start disappearing. Kinda like when the camera is going through a mesh it no longer has a need
to render what is behind it. In this case though the camera is still in the original location.
If you zoom in. Your camera will stay in one place, but the mesh will start disappearing. Kinda like when the camera is going through a mesh it no longer has a need
to render what is behind it. In this case though the camera is still in the original location.
Code: Select all
;PRESS Escape to exit
#CameraSpeed = 1
Define.f KeyX, KeyY, MouseX, MouseY
If InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()
ExamineDesktops()
DeskWid=DesktopWidth(0)
DeskHei=DesktopHeight(0)
If OpenWindow(0, 0, 0, DeskWid, DeskHei, "Orthographic Viewing", #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(0), 0, 0, DeskWid, DeskHei, 0, 0, 0)
BoxTexture=CreateTexture(#PB_Any,32,32)
StartDrawing(TextureOutput(BoxTexture))
Box(0,0,32,32,RGB(255,0,0))
StopDrawing()
BoxMaterial=CreateMaterial(#PB_Any, TextureID(BoxTexture))
BoxMesh=CreateCube(#PB_Any,100)
BoxEntity=CreateEntity(#PB_Any,MeshID(BoxMesh),MaterialID(BoxMaterial),0,-50,0)
PlaneTexture=CreateTexture(#PB_Any,32,32)
StartDrawing(TextureOutput(PlaneTexture))
Box(0,0,32,32,RGB(0,0,255))
StopDrawing()
PlaneMaterial=CreateMaterial(#PB_Any, TextureID(PlaneTexture))
PlaneMesh=CreatePlane(#PB_Any,10000,10000,10,10,10,10)
PlaneEntity=CreateEntity(#PB_Any,MeshID(PlaneMesh),MaterialID(PlaneMaterial),0,-500,0)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 0, 100, #PB_Absolute)
CameraLookAt(0,0,-50,0)
CameraProjectionMode(0, #PB_Camera_Orthographic)
CreateLight(0,RGB(255,255,255),500,500,200)
Repeat
If ExamineMouse()
MouseX = -MouseDeltaX() * #CameraSpeed * 0.05
MouseY = -MouseDeltaY() * #CameraSpeed * 0.05
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
EndIf
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
MoveCamera(0, KeyX, 0, KeyY)
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
EndIf
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized", 0)
EndIf
End