def render(self): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glLoadIdentity() SubWindowedScene.render(self) # self._log.debug(u"rendering main in window %d" % glutGetWindow()) glutSwapBuffers()
def render(self): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glLoadIdentity() SubWindowedScene.render(self) #self._log.debug(u"rendering main in window %d" % glutGetWindow()) glutSwapBuffers()
def _init_projection(self): SubWindowedScene._init_projection(self) window_width = glutGet(GLUT_WINDOW_WIDTH) window_height = glutGet(GLUT_WINDOW_HEIGHT) self._log.debug( u"Setting up projection in window %d (%d, %d)..." % (glutGetWindow(), window_width, window_height) ) # light and material self.mat_ambient = [0.5, 0.5, 0.5, 1.0] self.mat_specular = [0.6, 0.6, 0.6, 1.0] self.mat_shininess = [3.0] self.model_ambient = [0.5, 0.5, 0.5] self.light_position = [5.0, 5.0, 5.0, 0.0] self.light_ambient = [0.5, 0.5, 0.5, 1.0] glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, self.mat_ambient) glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, self.mat_specular) glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, self.mat_shininess) glLightfv(GL_LIGHT0, GL_POSITION, self.light_position) glLightfv(GL_LIGHT0, GL_AMBIENT, self.light_ambient) glLightModelfv(GL_LIGHT_MODEL_AMBIENT, self.model_ambient) glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) glEnable(GL_TEXTURE_2D) # shading glShadeModel(GL_SMOOTH) # glPolygonMode(GL_FRONT, GL_FILL) # glPolygonMode(GL_BACK, GL_LINE) glViewport(0, 0, window_width, window_height) # clear background to black and clear depth buffer glClearColor(0.0, 0.0, 0.0, 1.0) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # disable depth test (z-buffer) glEnable(GL_DEPTH_TEST) # enable normalization of vertex normals glEnable(GL_NORMALIZE) # enable line antialiasing glHint(GL_LINE_SMOOTH_HINT, GL_NICEST) glEnable(GL_LINE_SMOOTH) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glLineWidth(1.5)
def _init_projection(self): SubWindowedScene._init_projection(self) window_width = glutGet(GLUT_WINDOW_WIDTH) window_height = glutGet(GLUT_WINDOW_HEIGHT) self._log.debug(u"Setting up projection in window %d (%d, %d)..." % (glutGetWindow(), window_width, window_height)) # light and material self.mat_ambient = [0.5, 0.5, 0.5, 1.0] self.mat_specular = [0.6, 0.6, 0.6, 1.0] self.mat_shininess = [3.0] self.model_ambient = [0.5, 0.5, 0.5] self.light_position = [5.0, 5.0, 5.0, 0.0] self.light_ambient = [0.5, 0.5, 0.5, 1.0] glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, self.mat_ambient) glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, self.mat_specular) glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, self.mat_shininess) glLightfv(GL_LIGHT0, GL_POSITION, self.light_position) glLightfv(GL_LIGHT0, GL_AMBIENT, self.light_ambient) glLightModelfv(GL_LIGHT_MODEL_AMBIENT, self.model_ambient) glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) glEnable(GL_TEXTURE_2D) # shading glShadeModel(GL_SMOOTH) #glPolygonMode(GL_FRONT, GL_FILL) #glPolygonMode(GL_BACK, GL_LINE) glViewport(0, 0, window_width, window_height) # clear background to black and clear depth buffer glClearColor(0.0,0.0,0.0,1.0) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # disable depth test (z-buffer) glEnable(GL_DEPTH_TEST) # enable normalization of vertex normals glEnable(GL_NORMALIZE) # enable line antialiasing glHint(GL_LINE_SMOOTH_HINT, GL_NICEST) glEnable(GL_LINE_SMOOTH) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glLineWidth(1.5)
def init(self): self.children.append(TextureEditScene(self.application._subwindows[0], self.application)) self.children.append(TexturedObjectScene(self.application._subwindows[1], self.application)) SubWindowedScene.init(self)