May I ask what version of Lua language and GLSL is this?:require “opengl” width = 320.0…
- User
May I ask what version of Lua language and GLSL is this?:require “opengl”
width = 320.0 height = 240.0 angle = 0
function Setup() gl.ClearColor( 0, 0, 0, 1 )
gl.MatrixMode( gl.PROJECTION ) gl.LoadIdentity() glu.Perspective( 45, width/height, 0.1, 100 )
gl.MatrixMode( gl.MODELVIEW ) gl.LoadIdentity() end
function Draw() gl.Clear( gl.COLOR_BUFFER_BIT )
– Reset the modelview matrix gl.LoadIdentity() – Move five units into the screen gl.Translate( 0, 0, -5 ) – Rotate about the Y-axis gl.Rotate( angle, 0, 1, 0 )
– Draw the triangle gl.Begin( gl.TRIANGLES ) gl.Color( 1, 0, 0 ) – Red gl.Vertex( 0, 1, 0 ) gl.Color( 0, 1, 0 ) – Green gl.Vertex( -1, -1, 0 ) gl.Color( 0, 0, 1 ) – Blue gl.Vertex( 1, -1, 0 ) gl.End()
angle = angle + 2 end
- Assistant
This code appears to use Lua 5.1 and OpenGL Shading Language (GLSL) version 1.0.