update gl.py glut example code
authorDiane Trout <diane@caltech.edu>
Thu, 27 Jul 2006 01:24:46 +0000 (01:24 +0000)
committerDiane Trout <diane@caltech.edu>
Thu, 27 Jul 2006 01:24:46 +0000 (01:24 +0000)
py/gl.py

index a9d675b7afa5140676cb1d0841d7db43e694bdde..450b1bd0e4f5e9f690894b66d96807d8ba5769e1 100644 (file)
--- a/py/gl.py
+++ b/py/gl.py
@@ -9,11 +9,16 @@ import mussa
   
 class pyMussaGL:
   def __init__(self):
+    """Initalize our data and our glut window"""
+    # make up a simple sequence
     self.s = "AAGGCCTT" * 5
     self.seq = mussa.Sequence(self.s)
-    self.glseq = mussa.GlSequence(self.seq)
-    print self.glseq.width
+    # AnnotationColors is required, even though it'd be nice
+    # if it were optional
+    self.glseq = mussa.GlSequence(self.seq, mussa.AnnotationColors())
+    assert len(self.s) == self.glseq.length
 
+    # set up opengl buffer
     glutInit(sys.argv)
     glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH )
     glutCreateWindow('mussa')
@@ -25,6 +30,7 @@ class pyMussaGL:
     print "init done"
   
   def display(self):
+    """Update showing buffer"""
     glClear(GL_COLOR_BUFFER_BIT)
     self.glseq.draw(-50, self.glseq.width+50)
     #glutSwapBuffers()