本文整理汇总了Python中program.Program.load方法的典型用法代码示例。如果您正苦于以下问题:Python Program.load方法的具体用法?Python Program.load怎么用?Python Program.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类program.Program
的用法示例。
在下文中一共展示了Program.load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initgl
# 需要导入模块: from program import Program [as 别名]
# 或者: from program.Program import load [as 别名]
def initgl(self):
glEnable(GL_TEXTURE_2D)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
self.program = Program.load(in_module('glsl/flat.glsl'))
self.program_ms = Program.load(in_module('glsl/flat_ms.glsl'))
self.use_program(self.resolution)
self.stream = BufferStream(Vertex, GL_TRIANGLES)
示例2: __init__
# 需要导入模块: from program import Program [as 别名]
# 或者: from program.Program import load [as 别名]
def __init__(self, output, default_font, program=None):
self.output = output
self.default_font = default_font
self.stream = VertexStream(fmt)
self.textures = TextureCache()
if program is None:
self.program = Program.load(in_module('shaders/flat.glsl'))
else:
self.program = program
示例3: getList
# 需要导入模块: from program import Program [as 别名]
# 或者: from program.Program import load [as 别名]
class Board:
"""
Board definition and handling
"""
@staticmethod
def getList():
"""
Return the list of boards described into the configuration file
"""
boardDir = Config.getBoardDir()
boardFile = os.path.join(boardDir, "board_description.cfg")
Board.config = Config(boardFile)
boardList = Board.config.getItems("Boards")
return boardList
def __init__(self, boardName, display):
"""
initialize a board by loading its definition
@param boardName: name of board in board description file
@type boardName: string
@param display: where to display board
@type display: Windows
"""
self.display = display
self.deviceModuleList = []
self.program = None
self.boardHelp = None
self.archHelp = None
self.loadDefinition(boardName)
def loadDefinition(self, boardName):
"""
load the board definition from the definition file
@param boardName: name of board to look for in the description file
@type boardName: string
"""
items = Board.config.getItems(boardName)
self.deviceList = []
for item in items:
name = item[0]
value = item[1]
if name == "arch":
self.archName = value
elif name == "memory":
if (value == "max"):
self.memorySize = -1
else:
self.memorySize = int(value)
elif name[0:6] == "device":
device = shlex.split(value, "#")
self.deviceList.append(device)
elif name == "help":
fileName = os.path.join(Config.getBoardDir(), value)
if os.path.isfile(fileName):
self.boardHelp = fileName
def build(self):
"""
Build the board:
. load its architecture: chip with registers, opcodes and so on
. load its controller definition and initialize them
. initialize its memory
. attach controllers to their I/O addresses
"""
archDir = Config.getArchDir()
archPath = os.path.join(archDir, "arch_" + self.archName + ".py")
self.archModule = imp.load_source(self.archName, archPath)
self.archHelp = os.path.join(archDir, "arch_" + self.archName + ".html")
if not os.path.isfile(self.archHelp):
self.archHelp = None
self.chip = self.archModule.Chip()
if (self.memorySize == -1):
self.memorySize = 2 ** (self.chip.getAddressSize() * 8)
self.controller = Controller(self.display)
self.controller.loadDeviceList()
self.memory = Memory(self, self.memorySize)
self.memory.addController(self.controller)
for device in self.deviceList:
self.deviceModuleList.append(self.controller.createDevice(device))
def clear(self):
"""
Clear the board: reset memory and chip (PC, SP, other registers and so on)
"""
self.memory.clear()
self.chip.clear()
def delete(self):
"""
Delete the board: remove attached controllers
"""
self.controller.delete()
#.........这里部分代码省略.........