本文整理汇总了Python中bgl.glMatrixMode方法的典型用法代码示例。如果您正苦于以下问题:Python bgl.glMatrixMode方法的具体用法?Python bgl.glMatrixMode怎么用?Python bgl.glMatrixMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bgl
的用法示例。
在下文中一共展示了bgl.glMatrixMode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_darken
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glMatrixMode [as 别名]
def draw_darken(self):
bgl.glPushAttrib(bgl.GL_ALL_ATTRIB_BITS)
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glPushMatrix()
bgl.glLoadIdentity()
bgl.glColor4f(0,0,0,0.25) # TODO: use window background color??
bgl.glEnable(bgl.GL_BLEND)
bgl.glDisable(bgl.GL_DEPTH_TEST)
bgl.glBegin(bgl.GL_QUADS) # TODO: not use immediate mode
bgl.glVertex2f(-1, -1)
bgl.glVertex2f( 1, -1)
bgl.glVertex2f( 1, 1)
bgl.glVertex2f(-1, 1)
bgl.glEnd()
bgl.glPopMatrix()
bgl.glPopAttrib()
示例2: prepare_3D
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glMatrixMode [as 别名]
def prepare_3D(self):
bgl.glLoadIdentity()
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glLoadMatrixf(self.persmat_buffer)
示例3: restore_3D
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glMatrixMode [as 别名]
def restore_3D(self):
bgl.glLoadIdentity()
bgl.glMatrixMode(self.matrix_mode)
bgl.glLoadMatrixf(self.projection_matrix)
示例4: display_islands
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glMatrixMode [as 别名]
def display_islands(self, context):
# TODO: save the vertex positions and don't recalculate them always?
ob = context.active_object
if not ob or ob.type != 'MESH':
return
mesh = ob.data
if not mesh.paper_island_list or mesh.paper_island_index == -1:
return
bgl.glMatrixMode(bgl.GL_PROJECTION)
perspMatrix = context.space_data.region_3d.perspective_matrix
perspBuff = bgl.Buffer(bgl.GL_FLOAT, (4, 4), perspMatrix.transposed())
bgl.glLoadMatrixf(perspBuff)
bgl.glMatrixMode(bgl.GL_MODELVIEW)
objectBuff = bgl.Buffer(bgl.GL_FLOAT, (4, 4), ob.matrix_world.transposed())
bgl.glLoadMatrixf(objectBuff)
bgl.glEnable(bgl.GL_BLEND)
bgl.glBlendFunc(bgl.GL_SRC_ALPHA, bgl.GL_ONE_MINUS_SRC_ALPHA)
bgl.glEnable(bgl.GL_POLYGON_OFFSET_FILL)
bgl.glPolygonOffset(0, -10) # offset in Zbuffer to remove flicker
bgl.glPolygonMode(bgl.GL_FRONT_AND_BACK, bgl.GL_FILL)
bgl.glColor4f(1.0, 0.4, 0.0, self.islands_alpha)
island = mesh.paper_island_list[mesh.paper_island_index]
for lface in island.faces:
face = mesh.polygons[lface.id]
bgl.glBegin(bgl.GL_POLYGON)
for vertex_id in face.vertices:
vertex = mesh.vertices[vertex_id]
bgl.glVertex4f(*vertex.co.to_4d())
bgl.glEnd()
bgl.glPolygonOffset(0.0, 0.0)
bgl.glDisable(bgl.GL_POLYGON_OFFSET_FILL)
bgl.glLoadIdentity()
示例5: write
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glMatrixMode [as 别名]
def write():
"""write on screen"""
width = render.getWindowWidth()
height = render.getWindowHeight()
# OpenGL setup
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glLoadIdentity()
bgl.gluOrtho2D(0, width, 0, height)
#bgl.glColor(1,1,1,1)
bgl.glMatrixMode(bgl.GL_MODELVIEW)
bgl.glLoadIdentity()
# BLF drawing routine
font_id = logic.font_id
RED = (1, 0, 0, 1)
pcol = ("Blue ", RED)
#blf.color(font_id, 1, 1, 0, 0.5)
blf.blur(font_id,500)
blf.rotation(font_id, 90)
blf.position(font_id, (width * 0.5), (height * 0.5), 0.5)
blf.size(font_id, 20, 100)
blf.draw(font_id, "Hello World1")
blf.size(font_id, 50, 72)
blf.position(font_id, (width * 0.0), (height * 0.5), 0.5)
blf.draw(font_id, "Hello World2")
示例6: draw_preview
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glMatrixMode [as 别名]
def draw_preview(self):
bgl.glPushAttrib(bgl.GL_ALL_ATTRIB_BITS)
bgl.glMatrixMode(bgl.GL_MODELVIEW)
bgl.glPushMatrix()
bgl.glLoadIdentity()
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glPushMatrix()
bgl.glLoadIdentity()
bgl.glEnable(bgl.GL_BLEND)
bgl.glDisable(bgl.GL_DEPTH_TEST)
bgl.glBegin(bgl.GL_QUADS) # TODO: not use immediate mode
bgl.glColor4f(0,0,0.2,0.5)
bgl.glVertex2f(-1, -1)
bgl.glVertex2f( 1, -1)
bgl.glColor4f(0,0,0.2,0)
bgl.glVertex2f( 1, 1)
bgl.glVertex2f(-1, 1)
bgl.glEnd()
bgl.glPopMatrix()
bgl.glMatrixMode(bgl.GL_MODELVIEW)
bgl.glPopMatrix()
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glPopAttrib()
示例7: draw_postview
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glMatrixMode [as 别名]
def draw_postview(self):
bgl.glPushAttrib(bgl.GL_ALL_ATTRIB_BITS)
bgl.glMatrixMode(bgl.GL_MODELVIEW)
bgl.glPushMatrix()
bgl.glLoadIdentity()
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glPushMatrix()
bgl.glLoadIdentity()
bgl.glEnable(bgl.GL_BLEND)
bgl.glDisable(bgl.GL_DEPTH_TEST)
bgl.glBegin(bgl.GL_QUADS) # TODO: not use immediate mode
bgl.glColor4f(0,0,0,0)
bgl.glVertex2f(-1, -1)
bgl.glVertex2f( 1, -1)
bgl.glColor4f(0,0.2,0,0.5)
bgl.glVertex2f( 1, 1)
bgl.glVertex2f(-1, 1)
bgl.glEnd()
bgl.glPopMatrix()
bgl.glMatrixMode(bgl.GL_MODELVIEW)
bgl.glPopMatrix()
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glPopAttrib()
示例8: draw_postpixel
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glMatrixMode [as 别名]
def draw_postpixel(self):
bgl.glPushAttrib(bgl.GL_ALL_ATTRIB_BITS)
bgl.glEnable(bgl.GL_BLEND)
bgl.glMatrixMode(bgl.GL_MODELVIEW)
bgl.glPushMatrix()
bgl.glLoadIdentity()
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glPushMatrix()
bgl.glLoadIdentity()
bgl.glColor4f(1,0,0,0.2) # TODO: use window background color??
bgl.glEnable(bgl.GL_BLEND)
bgl.glDisable(bgl.GL_DEPTH_TEST)
bgl.glBegin(bgl.GL_QUADS) # TODO: not use immediate mode
bgl.glVertex2f(-1, -1)
bgl.glVertex2f( 1, -1)
bgl.glVertex2f( 1, 1)
bgl.glVertex2f(-1, 1)
bgl.glEnd()
bgl.glPopMatrix()
bgl.glMatrixMode(bgl.GL_MODELVIEW)
bgl.glPopMatrix()
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glPopAttrib()