def __init__(self, parent=None, image=None,application=None,winid=None): EMImage3DWidget.allim[self] = 0 EMGLWidget.__init__(self,parent) EMLightsDrawer.__init__(self) EMGLProjectionViewMatrices.__init__(self) fmt=QtOpenGL.QGLFormat() fmt.setDoubleBuffer(True) fmt.setDepth(True) fmt.setStencil(True) fmt.setSampleBuffers(True) self.setFormat(fmt) self.aspect=1.0 self.fov = 50 # field of view angle used by gluPerspective self.d = 0 self.zwidth = 0 self.yheight = None self.data = None # should eventually be an EMData object # self.cam = Camera() self.cam = Camera2(self) self.cam.cam_z = -250 self.resize(480,480) self.startz = 1 self.endz = 500 self.currentselection = -1 self.inspector = None self.viewables = [] self.num_iso = 0 self.num_vol = 0 self.num_sli = 0 self.num_sym = 0 self.vdtools = EMViewportDepthTools(self) self.last_window_width = -1 # used for automatic resizing from the desktop self.last_window_height = -1 # used for automatic resizing from the desktop self.file_name = None self.emit_events = False self.perspective = False if image != None: self.set_data(image) #From get_qt_widget... if isinstance(self.data,EMData): self.set_cam_z_from_fov_image(self.get_fov(),self.data) self.qt_parent.setWindowIcon(QtGui.QIcon(get_image_directory() +"single_image_3d.png")) #End from get_qt_widget self.updateGL() #Solves "error, OpenGL seems not to be initialized" message
def resizeEvent(self, event): self.vdtools.set_update_P_inv() EMGLWidget.resizeEvent(self, event)