From 581756feb3f092c867fe6f63c924b2e2b760f1ac Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Sun, 5 Mar 2006 23:21:20 +0000 Subject: [PATCH] mild improvements to demo python sequence view gl.py can successfully display a glSequence in a glut window. Not terribly exciting, but still its python driving a mussa view --- py/gl.py | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/py/gl.py b/py/gl.py index 43d29f6..4f9ca0d 100644 --- a/py/gl.py +++ b/py/gl.py @@ -1,18 +1,35 @@ """Can we show a mussa gl object? """ +import sys + from OpenGL.GLUT import * from OpenGL.GL import * import mussa -def main(): - seq = mussa.Sequence() - s = "AAGGCCTTAAGGCCTT" - seq = mussa.Sequence(s) - assert s == seq.size() == len(seq) - glseq = mussa.GlSequence(seq) - - glutInit(sys.argv) +class pyMussaGL: + def __init__(self): + seq = mussa.Sequence() + s = "AAGGCCTTAAGGCCTT" * 100 + seq = mussa.Sequence(s) + assert len(s) == seq.size() == len(seq) + self.glseq = mussa.GlSequence(seq) + + glutInit(sys.argv) + glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH ) + glutCreateWindow('mussa') + glClearColor(1,1,1,0) + + glOrtho(-50, len(seq)+50, -50, 50, -50, 50) + + glutDisplayFunc(self.display) + print "init done" + def display(self): + glClear(GL_COLOR_BUFFER_BIT) + self.glseq.draw() + glutSwapBuffers() + if __name__ == "__main__": - main() + p = pyMussaGL() + glutMainLoop() -- 2.30.2