本文整理汇总了Python中panda3d.core.Texture.set_ram_image方法的典型用法代码示例。如果您正苦于以下问题:Python Texture.set_ram_image方法的具体用法?Python Texture.set_ram_image怎么用?Python Texture.set_ram_image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.Texture
的用法示例。
在下文中一共展示了Texture.set_ram_image方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: peeker_from_pixel
# 需要导入模块: from panda3d.core import Texture [as 别名]
# 或者: from panda3d.core.Texture import set_ram_image [as 别名]
def peeker_from_pixel(component_type, format, data):
""" Creates a 1-pixel texture with the given settings and pixel data,
then returns a TexturePeeker as result of calling texture.peek(). """
tex = Texture("")
tex.setup_1d_texture(1, component_type, format)
tex.set_ram_image(data)
peeker = tex.peek()
assert peeker.has_pixel(0, 0)
return peeker
示例2: image_from_stored_pixel
# 需要导入模块: from panda3d.core import Texture [as 别名]
# 或者: from panda3d.core.Texture import set_ram_image [as 别名]
def image_from_stored_pixel(component_type, format, data):
""" Creates a 1-pixel texture with the given settings and pixel data,
then returns a PNMImage as result of calling texture.store(). """
tex = Texture("")
tex.setup_1d_texture(1, component_type, format)
tex.set_ram_image(data)
img = PNMImage()
assert tex.store(img)
return img