GetSurface

This function gets a model surface.

Syntax

Parameters

Returns

Returns the surface at the specified index.

Example

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

local model = Model:Load("Models/Grass/grass01.mdl")
local surface = model:GetSurface(0)

for v=0,surface:CountVertices()-1 do

surface:SetVertexColor(v,2,0.5,2,1)
end

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

Time:Update()
world:Update()
world:Render()
context:Sync()

end