mild improvements to demo python sequence view
[mussa.git] / py / gl.py
1 """Can we show a mussa gl object?
2 """
3 import sys
4
5 from OpenGL.GLUT import *
6 from OpenGL.GL import *
7 import mussa
8
9   
10 class pyMussaGL:
11   def __init__(self):
12     seq = mussa.Sequence()
13     s = "AAGGCCTTAAGGCCTT" * 100
14     seq = mussa.Sequence(s)
15     assert len(s) == seq.size() == len(seq)
16     self.glseq = mussa.GlSequence(seq)
17
18     glutInit(sys.argv)
19     glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH )
20     glutCreateWindow('mussa')
21     glClearColor(1,1,1,0)
22
23     glOrtho(-50, len(seq)+50, -50, 50, -50, 50)
24
25     glutDisplayFunc(self.display)
26     print "init done"
27   
28   def display(self):
29     glClear(GL_COLOR_BUFFER_BIT)
30     self.glseq.draw()
31     glutSwapBuffers()
32
33 if __name__ == "__main__":
34   p = pyMussaGL()
35   glutMainLoop()