function widget:GetInfo() return { name = "!GL test", desc = "Indicator for the CommEnds state (at game start)", author = "q", date = "Jan 8, 2007", license = "GNU GPL, v2 or later", layer = -3, enabled = false -- loaded by default? } end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- m = 0 firstTime = true A = { -1, 1, 1} B = { 1, 1, 1} C = { 1, -1, 1} D = { -1, -1, 1} E = { -1, 1, -1} F = { 1, 1, -1} G = { 1, -1, -1} H = { -1, -1, -1} local vsx, vsy = widgetHandler:GetViewSizes() function widget:Initialize() cubeListNumber = gl.CreateList(function() gl.BeginEnd(GL.QUADS, function() Cube(A, B, C, D, E, F, G, H) end ) end ) end function widget:Shutdown() gl.DeleteList(cubeListNumber) end function widget:DrawScreen() m = m + 1 n = math.sin(m/100) gl.MatrixMode(GL.MODELVIEW) gl.PushMatrix() gl.Scale(44, 44, 44) gl.Translate( 9+n, 8+n, 20+2*n) gl.Rotate(m, 0, 1, 0) gl.Rotate(m, 0, 0, 1) gl.Culling( false ) gl.DepthTest( true ) gl.DepthMask( true ) gl.MatrixMode(GL.TEXTURE) gl.PushMatrix() gl.Rotate(-45, 0, 0, 1) gl.Texture("bitmaps/armsilo1.bmp") gl.CallList(cubeListNumber) gl.PopMatrix() gl.PopMatrix() end function Cube(A, B, C, D, E, F, G, H) Face(A, B, C, D) Face(E, F, G, H) Face(B, F, G, C) Face(A, E, H, D) Face(A, B, F, E) Face(D, C, G, H) end function Face(A, B, C, D) gl.TexCoord(-2, 2) gl.Vertex(A[1], A[2], A[3]) gl.TexCoord( 2, 2) gl.Vertex(B[1], B[2], B[3]) gl.TexCoord( 2,-2) gl.Vertex(C[1], C[2], C[3]) gl.TexCoord(-2,-2) gl.Vertex(D[1], D[2], D[3]) end