本文整理汇总了Python中Camera.Camera.setViewportDimensions方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.setViewportDimensions方法的具体用法?Python Camera.setViewportDimensions怎么用?Python Camera.setViewportDimensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera.Camera
的用法示例。
在下文中一共展示了Camera.setViewportDimensions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GLWidget
# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import setViewportDimensions [as 别名]
#.........这里部分代码省略.........
glEnable( GL_DEPTH_TEST );
colors = { "projA" : [1,0,0],
"projB" : [0,1,0],
"projC" : [0,0,1],
"projC" : [1,1,0] }
glPushMatrix()
glLoadIdentity()
#self.projectors.drawA(self.canvasModel,colors["projA"])
#self.projectors.drawB(self.canvasModel,colors["projB"])
#self.projectors.drawC(self.canvasModel,colors["projC"])
#self.projectors.drawD(self.canvasModel,colors["projD"])
glPopMatrix()
if self.showCanvas:
mode = GLU_FILL
texture = None
if self.selTexture in self.textures:
texture = self.textures[self.selTexture]
shader = self.shaders[str(self.canvasModel.__class__)+"_inv_proj"]
shader.use()
self.canvasModel.shaderSettings(shader)
self.projectors.shaderSettings(shader)
shader.set(proj_multi = ("4f",[[1.0,1.0,1.0,1.0]]))
self.canvasModel.draw(mode,texture,colors,None,self.selectedProj)
shader.unuse()
drawProjectorImage()
glFlush()
def resizeGL(self, widthInPixels, heightInPixels):
self.camera.setViewportDimensions(widthInPixels, heightInPixels)
glViewport(0, 0, widthInPixels, heightInPixels)
def initializeGL(self):
glClearColor(0.0, 0.0, 0.0, 1.0)
glClearDepth(1.0)
domeStr = "CanvasModel.Dome"
self.shaders[domeStr+"_proj"] = Shader("shaders/dome_proj.vert","shaders/dome_4proj.frag")
self.shaders[domeStr+"_edgeblend"] = Shader("shaders/dome_edgeblend.vert","shaders/dome_edgeblend_4proj.frag")
self.shaders[domeStr+"_inv_proj"] = Shader("shaders/dome_inv_proj.vert","shaders/dome_inv_proj.frag")
# cycloramaStr = "CanvasModel.Cyclorama"
# self.shaders[cycloramaStr+"_proj"] = Shader("shaders/cyclorama_proj.vert","shaders/dome_proj.frag")
# self.shaders[cycloramaStr+"_edgeblend"] = Shader("shaders/cyclorama_edgeblend.vert","shaders/cyclorama_edgeblend.frag")
# self.shaders[cycloramaStr+"_inv_proj"] = Shader("shaders/dome_inv_proj.vert","shaders/dome_inv_proj.frag")
for textureFile in self.textureFiles:
texFile = os.path.join(TEXTURE_PATH,textureFile)
self.textures[textureFile[:-4]] = Texture(texFile)
def mouseMoveEvent(self, mouseEvent):
if int(mouseEvent.buttons()) != QtCore.Qt.NoButton :
# user is dragging
delta_x = mouseEvent.x() - self.oldx
delta_y = self.oldy - mouseEvent.y()
if int(mouseEvent.buttons()) & QtCore.Qt.LeftButton :
if int(mouseEvent.buttons()) & QtCore.Qt.MidButton :
self.camera.dollyCameraForward( 3*(delta_x+delta_y), False )
else:
self.camera.orbit(self.oldx,self.oldy,mouseEvent.x(),mouseEvent.y())
elif int(mouseEvent.buttons()) & QtCore.Qt.MidButton :
self.camera.translateSceneRightAndUp( delta_x, delta_y )
self.update()