File: DemoPlugin.py

package info (click to toggle)
pymca 4.7.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 52,352 kB
  • ctags: 9,570
  • sloc: python: 116,490; ansic: 18,322; cpp: 826; sh: 57; xml: 24; makefile: 19
file content (29 lines) | stat: -rw-r--r-- 952 bytes parent folder | download | duplicates (2)
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
from Object3D import Object3DBase
from OpenGL.GL import *

class Object3DDemo(Object3DBase.Object3D):
    def __init__(self, name="Demo"):
        Object3DBase.Object3D.__init__(self, name)
        
        # I have to give the limits I am going to use in order
        # to calculate a proper bounding box
        self.setLimits(-1.0, 0.0, 0.0, 1.0, 1.0, 0.0)
    
    def drawObject(self):
        # this is to handle transparency
        alpha = 1. - self._configuration['common']['transparency']

        #some simple drawing
        glShadeModel(GL_SMOOTH)
        glBegin(GL_TRIANGLES)
        glColor4f(  1.0, 0.0, 0.0, alpha)
        glVertex3f(-1.0, 0.0, 0.0)
        glColor4f(  0.0, 1.0, 0.0, alpha)
        glVertex3f( 0.0, 1.0, 0.0)
        glColor4f(  0.0, 0.0, 1.0, alpha)
        glVertex3f( 1.0, 0.0, 0.0)
        glEnd()

MENU_TEXT = 'Demo'
def getObject3DInstance(config=None):
    return Object3DDemo()