📅 2013-Jun-18 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ freeglut, glu, glut, ironpython, opengl, tao framework, visual studio ⬩ 📚 Archive
# IronPython example program to demonstrate Tao Framework
#
# Steps:
# 1. Install Tao Framework.
# 2. Create an empty IronPython project in Visual Studio
# 3. Place Tao.OpenGl.dll and Tao.FreeGlut.dll in directory of Python source file.
# These DLL files are found in C:\Program Files (x86)\TaoFramework\bin
# 4. Place freeglut.dll in directory of Python source file.
# This DLL file is found in C:\Program Files (x86)\TaoFramework\lib
# 5. Paste this source code into the Python source file
# 6. Run. You should see a grey teapot.
#
# Copyright (c) 2013 Ashwin Nanjappa
# Released under the MIT License
import clr
"Tao.OpenGl.dll")
clr.AddReferenceToFile("Tao.FreeGlut.dll")
clr.AddReferenceToFile(
import Tao.OpenGl.Gl as Gl
import Tao.OpenGl.Glu as Glu
import Tao.FreeGlut.Glut as Glut
def init_graphics():
Gl.glEnable(Gl.GL_LIGHTING)
Gl.glEnable(Gl.GL_LIGHT0)1, .5, 1))
Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_POSITION, (
Gl.glEnable(Gl.GL_DEPTH_TEST)1, 1, 1, 1)
Gl.glClearColor(
def on_display():
| Gl.GL_DEPTH_BUFFER_BIT)
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT
Gl.glLoadIdentity()0, 0, 5, 0, 0, 1, 0, 1, 0)
Glu.gluLookAt(1)
Glut.glutSolidTeapot(
Glut.glutSwapBuffers()
def on_reshape(w, h):
Gl.glMatrixMode(Gl.GL_PROJECTION)
Gl.glLoadIdentity()0, 0, w, h)
Gl.glViewport(40, float(w) / h, 1, 100)
Glu.gluPerspective(
Gl.glMatrixMode(Gl.GL_MODELVIEW)
def main():
Glut.glutInit()500, 500)
Glut.glutInitWindowSize("Tao Example")
Glut.glutCreateWindow(
init_graphics()
Glut.glutDisplayFunc(on_display)
Glut.glutReshapeFunc(on_reshape)
Glut.glutMainLoop()
if "__main__" == __name__:
main()