SetProjectionMode

This function sets the projection mode of a camera.

Syntax

Parameters

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

model = Model:Box()
model:SetColor(0.0,0.0,1.0)

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

model:Turn(0,Time:GetSpeed(),0)

if (window:KeyHit(Key.Space)) then
if (camera:GetProjectionMode()==Camera.Orthographic) then
camera:SetProjectionMode(Camera.Perspective)
camera:SetZoom(1)
else
camera:SetProjectionMode(Camera.Orthographic)
camera:SetZoom(100)
end
end

Time:Update()
world:Update()
world:Render()

context:SetBlendMode(Blend.Alpha)
context:DrawText("Projection mode: "..camera:GetProjectionMode(),2,2)
context:DrawText("Zoom: "..camera:GetZoom(),2,22)

context:Sync()
end