本文整理汇总了Python中opengltk.OpenGL.GL.glFinish方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glFinish方法的具体用法?Python GL.glFinish怎么用?Python GL.glFinish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opengltk.OpenGL.GL
的用法示例。
在下文中一共展示了GL.glFinish方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: endTile
# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glFinish [as 别名]
def endTile(self):
assert(self.CurrentTile>=0)
# be sure OpenGL rendering is finished
GL.glFinish() #was glFlush()
# save current glPixelStore values
prevRowLength = GL.glGetIntegerv(GL.GL_PACK_ROW_LENGTH)[0]
prevSkipRows = GL.glGetIntegerv(GL.GL_PACK_SKIP_ROWS)[0]
prevSkipPixels = GL.glGetIntegerv(GL.GL_PACK_SKIP_PIXELS)[0]
#prevAlignment = GL.glGetIntegerv(GL_PACK_ALIGNMENT)[0]
if self.TileBuffer is not None:
srcX = self.TileBorder
srcY = self.TileBorder
srcWidth = self.TileWidthNB
srcHeight = self.TileHeightNB
GL.glReadPixels(srcX, srcY, srcWidth, srcHeight,
self.TileFormat, self.TileType, self.TileBuffer)
if self.ImageBuffer is not None:
srcX = self.TileBorder
srcY = self.TileBorder
srcWidth = self.CurrentTileWidth - 2 * self.TileBorder
srcHeight = self.CurrentTileHeight - 2 * self.TileBorder
destX = self.TileWidthNB * self.CurrentColumn
destY = self.TileHeightNB * self.CurrentRow
## #save single tile
## # setup pixel store for glReadPixels
## GL.glPixelStorei(GL.GL_PACK_ROW_LENGTH, self.CurrentTileWidth)
## GL.glPixelStorei(GL.GL_PACK_SKIP_ROWS, 0)
## GL.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, 0)
## #GL.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1)
## # read the tile into buffer
## gllib.glReadPixels(srcX, srcY, srcWidth, srcHeight,
## self.ImageFormat, self.ImageType, self.oneTileRenderBuffer)
## import Image, sys
## im = Image.fromstring('RGB', (srcWidth, srcHeight),
## self.oneTileRenderBuffer)
## if sys.platform!='win32':
## im = im.transpose(Image.FLIP_TOP_BOTTOM)
## im.save('tile%d_%d.tif'%(self.CurrentRow, self.CurrentColumn))
# setup pixel store for glReadPixels
GL.glPixelStorei(GL.GL_PACK_ROW_LENGTH, self.ImageWidth)
GL.glPixelStorei(GL.GL_PACK_SKIP_ROWS, destY)
GL.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, destX)
#GL.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1)
# read the tile into the final image
#print 'DEBUG Tile renderer'
#print 'column, row:', self.CurrentColumn, self.CurrentRow
#print 'srcWidth,srcHeight,destX, destY',srcWidth,srcHeight,destX, destY
gllib.glReadPixels(srcX, srcY, srcWidth, srcHeight,
self.ImageFormat, self.ImageType, self.ImageBuffer)
# restore previous glPixelStore values
GL.glPixelStorei(GL.GL_PACK_ROW_LENGTH, int(prevRowLength))
GL.glPixelStorei(GL.GL_PACK_SKIP_ROWS, int(prevSkipRows))
GL.glPixelStorei(GL.GL_PACK_SKIP_PIXELS, int(prevSkipPixels))
#GL.glPixelStorei(GL.GL_PACK_ALIGNMENT, prevAlignment)
# increment tile counter, return 1 if more tiles left to render
self.CurrentTile+=1
if self.CurrentTile >= self.Rows * self.Columns:
# restore user's viewport
GL.glViewport(int(self.ViewportSave[0]), int(self.ViewportSave[1]),
int(self.ViewportSave[2]), int(self.ViewportSave[3]))
self.CurrentTile = -1 # all done
return 0
else:
return 1