Quick updated code:
--Initialize Steamworks (optional)
Steamworks:Initialize()
--Set the application title
title="test"
--Create a window
local windowstyle = window.Titlebar
if System:GetProperty("fullscreen")=="1" then windowstyle=windowstyle+window.FullScreen end
window=Window:Create(title,0,0,System:GetProperty("screenwidth","1024"),System:GetProperty("screenheight","768"),windowstyle)
window:HideMouse()
--Create the graphics context
context=Context:Create(window,0)
if context==nil then return end
--Create a world
world=World:Create()
world:SetLightQuality((System:GetProperty("lightquality","1")))
--create buffer, acamera and material
buffer = Buffer:GetCurrent()
camera = Camera:Create()
light = DirectionalLight:Create()
light:SetRotation(45,45,45)
box1 = Model:Box()
mat1 = Material:Create()
shader = Shader:Load("Shaders/model/diffuse.shader")
mat1:SetShader(shader)
shader:Release()
box1:SetPosition(0,0,3)
box1:SetMaterial(mat1)
mybuffer = Buffer:Create(100,100,1,1)
while window:KeyDown(Key.Escape)==false do
box1:Turn(1,1,1)
--If window has been closed, end the program
if window:Closed() then break end
--Update the app timing
Time:Update()
--Update the world
world:Update()
--Render the world
world:Render()
--draw context to buffer
Buffer:SetCurrent(mybuffer)
context:SetBlendMode(Blend.Alpha)
context:SetColor(.1,.1,.1,1)
context:DrawRect(0,0,100,100)
context:SetColor(1,.5,0,1)
context:DrawText(string.format("FPS: %.2f",Time:UPS()),15,40)
tex = mybuffer:GetColorTexture(0)
mat1:SetTexture(tex,0)
Buffer:SetCurrent(context)
--Refresh the screen
context:Sync(true)
end
Pic