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() bgcolor = [1.0,1.0,1.0,0.0] #bgcolor = [0.0,0.0,0.0,0.0] glClearColor(*bgcolor) glEnable(GL_MULTISAMPLE) glDepthFunc(GL_LESS) glEnable(GL_ALPHA_TEST) glEnable(GL_DEPTH_TEST) glEnable(GL_BLEND) glEnable(GL_LINE_SMOOTH) glHint(GL_LINE_SMOOTH_HINT, GL_NICEST) self.setup_lighting() glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) self.ellipsoid = quadrics.proto_ellipsoid(slices=32, stacks=32) gltbx.util.handle_error()
def InitGL(self): gltbx.util.handle_error() bgcolor = self.settings.opengl.background_color + [0.0] glClearColor(*bgcolor) self.minimum_covering_sphere_display_list = None glDepthFunc(GL_LESS) glEnable(GL_ALPHA_TEST) glEnable(GL_DEPTH_TEST) glEnable(GL_BLEND) # XXX: line smoothing is pretty essential for wireframe representation; # the problem with nvidia cards is really only a problem for the isomesh # in wx_map_viewer.py. glEnable(GL_LINE_SMOOTH) glHint(GL_LINE_SMOOTH_HINT, GL_NICEST) self.initialize_modelview() glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) self.proto_ellipsoid = quadrics.proto_ellipsoid(slices=32, stacks=32) 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()
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()