File: gl01.py

package info (click to toggle)
pymol 1.2r2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 38,716 kB
  • ctags: 23,006
  • sloc: ansic: 480,417; python: 70,953; cpp: 12,928; sh: 10,266; makefile: 530; csh: 21
file content (38 lines) | stat: -rw-r--r-- 689 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from pymol.opengl.gl import *
from pymol.callback import Callback
from pymol import cmd

# this is a trivial example of creating a callback object which
# makes OpenGL calls using the PyOpenGL bindings

# define a callback object

class myCallback(Callback):

   def __call__(self):
      
      glBegin(GL_LINES)
      
      glColor3f(1.0,1.0,1.0)
      
      glVertex3f(0.0,0.0,0.0)
      glVertex3f(1.0,0.0,0.0)

      glVertex3f(0.0,0.0,0.0)
      glVertex3f(0.0,2.0,0.0)

      glVertex3f(0.0,0.0,0.0)
      glVertex3f(0.0,0.0,3.0)

      glEnd()

   def get_extent(self):
      return [[0.0,0.0,0.0],[1.0,2.0,3.0]]

# load it into PyMOL

cmd.load_callback(myCallback(),'gl01')