GetClampMode

This function gets the clamp mode of a texture.

Syntax

Parameters

Example

window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
light = DirectionalLight:Create()
light:SetRotation(45,35,0)

--Create a material
local material = Material:Create()

--Load and apply a texture
texture = Texture:Load("Materials/Grass/grass01.tex")
texture:SetClampMode(true,true)

material:SetTexture(texture)
texture:Release()

--Load and apply a shader
local shader = Shader:Load("Shaders/Decal/diffuse.shader")
material:SetShader(shader)
shader:Release()

--Create a model and apply the material
local model = Model:Box()
model:SetMaterial(material)
model:SetPosition(0,0,2)

--Adjust the vertex texcoords so we can see the clamping
local surface = model:GetSurface(0)
for v=0, surface:CountVertices()-1 do
texcoords = surface:GetVertexTexCoords(v)
surface:SetVertexTexCoords(v,texcoords.x*2.0,texcoords.y*2.0)
end
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

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

context:SetBlendMode(Blend.Alpha)
context:DrawText("Clamp mode: " .. tostring(texture:GetClampMode(0)).. ", " .. tostring(texture:GetClampMode(1)),2,2)
context:SetBlendMode(Blend.Solid)

context:Sync()
end