Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
42
Task/OpenGL/Lua/opengl.lua
Normal file
42
Task/OpenGL/Lua/opengl.lua
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
local gl = require "luagl"
|
||||
local iup = require "iuplua"
|
||||
require "iupluagl"
|
||||
|
||||
local function paint()
|
||||
gl.ClearColor(0.3,0.3,0.3,0.0)
|
||||
gl.Clear"COLOR_BUFFER_BIT,DEPTH_BUFFER_BIT"
|
||||
|
||||
gl.ShadeModel"SMOOTH"
|
||||
|
||||
gl.LoadIdentity()
|
||||
gl.Translate(-15.0, -15.0, 0.0)
|
||||
|
||||
gl.Begin"TRIANGLES"
|
||||
gl.Color(1.0, 0.0, 0.0)
|
||||
gl.Vertex(0.0, 0.0)
|
||||
gl.Color(0.0, 1.0, 0.0)
|
||||
gl.Vertex(30.0, 0.0)
|
||||
gl.Color(0.0, 0.0, 1.0)
|
||||
gl.Vertex(0.0, 30.0)
|
||||
gl.End()
|
||||
|
||||
gl.Flush()
|
||||
end
|
||||
|
||||
local function reshape(width, height)
|
||||
gl.Viewport(0, 0, width, height)
|
||||
gl.MatrixMode"PROJECTION"
|
||||
gl.LoadIdentity()
|
||||
gl.Ortho(-30.0, 30.0, -30.0, 30.0, -30.0, 30.0)
|
||||
gl.MatrixMode"MODELVIEW"
|
||||
end
|
||||
|
||||
local glc = iup.glcanvas{rastersize="640x480"}
|
||||
function glc:action() paint() end
|
||||
function glc:resize_cb(w,h) reshape(w,h) end
|
||||
function glc:map_cb() iup.GLMakeCurrent(self) end
|
||||
|
||||
local dlg = iup.dialog{title="Triangle", shrink="yes"; glc}
|
||||
dlg:show()
|
||||
|
||||
iup.MainLoop()
|
||||
Loading…
Add table
Add a link
Reference in a new issue