Python bgl.glLoadIdentity() Examples
The following are 8
code examples of bgl.glLoadIdentity().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
bgl
, or try the search function
.
Example #1
Source File: ui.py From addon_common with GNU General Public License v3.0 | 6 votes |
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()
Example #2
Source File: gl.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def prepare_3D(self): bgl.glLoadIdentity() bgl.glMatrixMode(bgl.GL_PROJECTION) bgl.glLoadMatrixf(self.persmat_buffer)
Example #3
Source File: gl.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def restore_3D(self): bgl.glLoadIdentity() bgl.glMatrixMode(self.matrix_mode) bgl.glLoadMatrixf(self.projection_matrix)
Example #4
Source File: io_export_paper_model.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
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()
Example #5
Source File: textRenderExample.py From FlowState with GNU General Public License v3.0 | 5 votes |
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")
Example #6
Source File: test.py From addon_common with GNU General Public License v3.0 | 5 votes |
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()
Example #7
Source File: test.py From addon_common with GNU General Public License v3.0 | 5 votes |
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()
Example #8
Source File: test.py From addon_common with GNU General Public License v3.0 | 5 votes |
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()