def initialise_opengl(self):
     self.ellipsoid_proto = quadrics.proto_ellipsoid(slices=32, stacks=32)
     self.principal_ellipses_tex = \
         quadrics.ellipsoid_principal_sections_texture(darkening=0.75,
                                                       n_s=64, n_t=64)
     self.cylindre_proto = quadrics.proto_cylinder(slices=16)
     self.bond_material = gl_managed.material_model(
         ambient_front_colour=(0.2, ) * 3, diffuse_front_colour=(0.1, ) * 3)
     glEnable(GL_TEXTURE_2D)
     glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)
 def initialise_opengl(self):
   self.ellipsoid_proto = quadrics.proto_ellipsoid(
     slices=32, stacks=32)
   self.principal_ellipses_tex = \
       quadrics.ellipsoid_principal_sections_texture(darkening=0.75,
                                                     n_s=64, n_t=64)
   self.cylindre_proto = quadrics.proto_cylinder(slices=16)
   self.bond_material = gl_managed.material_model(
     ambient_front_colour=(0.2,)*3,
     diffuse_front_colour=(0.1,)*3)
   glEnable(GL_TEXTURE_2D)
   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)
    def InitGL(self):
        gltbx.util.handle_error()

        self.initialize_modelview(
            angle=45)  # that does glMatrixMode(GL_MODELVIEW)
        # so we can safely position the light
        # later in this method
        self.buffer_factor = 2.

        glEnable(GL_NORMALIZE)  # mighty important because we use non-uniform
        # scaling to render cylinders and ellipsoids,
        # which also means thatGL_RESCALE_NORMALS
        # would not do here

        # Colours and lighting
        glClearColor(0., 0., 0., 0.)
        glShadeModel(GL_SMOOTH)
        glEnable(GL_DEPTH_TEST)
        glEnable(GL_LIGHTING)
        glEnable(GL_LIGHT0)
        glLightfv(GL_LIGHT0, GL_POSITION, [0, 0, 1, 0])
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
        glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE)
        glLightModelfv(GL_LIGHT_MODEL_AMBIENT, [0.5, 0.5, 0.5, 1.0])
        glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (0.2, 0.2, 0.2, 1.))
        glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (1, 1, 1, 1.))
        glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 50.)

        # We build our quadrics
        self.proto_cylinder = quadrics.proto_cylinder(slices=16)
        self.proto_ellipsoid = quadrics.proto_ellipsoid(slices=32, stacks=32)

        # We build the texture to paint the principal ellipses on ellipsoids
        self.principal_ellipses_tex = \
          quadrics.ellipsoid_principal_sections_texture(darkening=0.75,
                                                        n_s=64, n_t=64)

        # Enable texturing and specify how to lay the texture on the ellipsoids
        glEnable(GL_TEXTURE_2D)
        glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)

        gltbx.util.handle_error()
  def InitGL(self):
    gltbx.util.handle_error()

    self.initialize_modelview(angle=45) # that does glMatrixMode(GL_MODELVIEW)
                                        # so we can safely position the light
                                        # later in this method
    self.buffer_factor = 2.

    glEnable(GL_NORMALIZE) # mighty important because we use non-uniform
                           # scaling to render cylinders and ellipsoids,
                           # which also means thatGL_RESCALE_NORMALS
                           # would not do here

    # Colours and lighting
    glClearColor(0., 0., 0., 0.)
    glShadeModel(GL_SMOOTH)
    glEnable(GL_DEPTH_TEST)
    glEnable(GL_LIGHTING)
    glEnable(GL_LIGHT0)
    glLightfv(GL_LIGHT0, GL_POSITION, [0, 0, 1, 0])
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
    glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE)
    glLightModelfv(GL_LIGHT_MODEL_AMBIENT, [0.5, 0.5, 0.5, 1.0])
    glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (0.2, 0.2, 0.2, 1.))
    glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (1, 1, 1, 1.))
    glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 50.)

    # We build our quadrics
    self.proto_cylinder = quadrics.proto_cylinder(slices=16)
    self.proto_ellipsoid = quadrics.proto_ellipsoid(slices=32, stacks=32)

    # We build the texture to paint the principal ellipses on ellipsoids
    self.principal_ellipses_tex = \
      quadrics.ellipsoid_principal_sections_texture(darkening=0.75,
                                                    n_s=64, n_t=64)

    # Enable texturing and specify how to lay the texture on the ellipsoids
    glEnable(GL_TEXTURE_2D)
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)

    gltbx.util.handle_error()