本文整理汇总了Python中OpenGL.GL.glLineWidth方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glLineWidth方法的具体用法?Python GL.glLineWidth怎么用?Python GL.glLineWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenGL.GL
的用法示例。
在下文中一共展示了GL.glLineWidth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_box
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glLineWidth [as 别名]
def draw_box(self, x0, y0, x1, y1):
'''Draws a selection box in the 3-D window.
Coordinates are with respect to the lower left corner of the window.
'''
import OpenGL.GL as gl
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glLoadIdentity()
gl.glOrtho(0.0, self.size[0],
0.0, self.size[1],
-0.01, 10.0)
gl.glLineStipple(1, 0xF00F)
gl.glEnable(gl.GL_LINE_STIPPLE)
gl.glLineWidth(1.0)
gl.glColor3f(1.0, 1.0, 1.0)
gl.glBegin(gl.GL_LINE_LOOP)
gl.glVertex3f(x0, y0, 0.0)
gl.glVertex3f(x1, y0, 0.0)
gl.glVertex3f(x1, y1, 0.0)
gl.glVertex3f(x0, y1, 0.0)
gl.glEnd()
gl.glDisable(gl.GL_LINE_STIPPLE)
gl.glFlush()
self.resize(*self.size)
示例2: drawFaceVertices
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glLineWidth [as 别名]
def drawFaceVertices(self, buf):
if 0 == len(buf):
return
stride = elementByteLength
GL.glVertexPointer(3, GL.GL_FLOAT, stride, (buf.ravel()))
GL.glTexCoordPointer(2, GL.GL_FLOAT, stride, (buf.ravel()[3:]))
GL.glColorPointer(4, GL.GL_UNSIGNED_BYTE, stride, (buf.view(dtype=numpy.uint8).ravel()[20:]))
GL.glDepthMask(False)
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
GL.glLineWidth(2.0)
GL.glDrawArrays(GL.GL_QUADS, 0, len(buf) * 4)
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)
GL.glPolygonOffset(DepthOffset.TerrainWire, DepthOffset.TerrainWire)
with gl.glEnable(GL.GL_POLYGON_OFFSET_FILL, GL.GL_DEPTH_TEST):
GL.glDrawArrays(GL.GL_QUADS, 0, len(buf) * 4)
GL.glDepthMask(True)
示例3: drawTerrainCuttingWire
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glLineWidth [as 别名]
def drawTerrainCuttingWire(box,
c0=(0.75, 0.75, 0.75, 0.4),
c1=(1.0, 1.0, 1.0, 1.0)):
# glDepthMask(False)
GL.glEnable(GL.GL_DEPTH_TEST)
GL.glDepthFunc(GL.GL_LEQUAL)
GL.glColor(*c1)
GL.glLineWidth(2.0)
drawCube(box, cubeType=GL.GL_LINE_STRIP)
GL.glDepthFunc(GL.GL_GREATER)
GL.glColor(*c0)
GL.glLineWidth(1.0)
drawCube(box, cubeType=GL.GL_LINE_STRIP)
GL.glDepthFunc(GL.GL_LEQUAL)
GL.glDisable(GL.GL_DEPTH_TEST)
# glDepthMask(True)
示例4: drawPlane
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glLineWidth [as 别名]
def drawPlane(num_divs=200, div_size=10):
# Plane parallel to x-z at origin with normal -y
minx = -num_divs*div_size
minz = -num_divs*div_size
maxx = num_divs*div_size
maxz = num_divs*div_size
#gl.glLineWidth(2)
#gl.glColor3f(0.7,0.7,1.0)
gl.glColor3f(0.7,0.7,0.7)
gl.glBegin(gl.GL_LINES)
for n in range(2*num_divs):
gl.glVertex3f(minx+div_size*n,0,minz)
gl.glVertex3f(minx+div_size*n,0,maxz)
gl.glVertex3f(minx,0,minz+div_size*n)
gl.glVertex3f(maxx,0,minz+div_size*n)
gl.glEnd()
示例5: drawFaceVertices
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glLineWidth [as 别名]
def drawFaceVertices(self, buf):
if not len(buf):
return
stride = elementByteLength
GL.glVertexPointer(3, GL.GL_FLOAT, stride, (buf.ravel()))
GL.glTexCoordPointer(2, GL.GL_FLOAT, stride, (buf.ravel()[3:]))
GL.glColorPointer(4, GL.GL_UNSIGNED_BYTE, stride, (buf.view(dtype=numpy.uint8).ravel()[20:]))
GL.glDepthMask(False)
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
GL.glLineWidth(2.0)
GL.glDrawArrays(GL.GL_QUADS, 0, len(buf) * 4)
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)
GL.glPolygonOffset(DepthOffset.TerrainWire, DepthOffset.TerrainWire)
with gl.glEnable(GL.GL_POLYGON_OFFSET_FILL, GL.GL_DEPTH_TEST):
GL.glDrawArrays(GL.GL_QUADS, 0, len(buf) * 4)
GL.glDepthMask(True)
示例6: drawConstructionCube
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glLineWidth [as 别名]
def drawConstructionCube(self, box, color, texture=None):
if texture is None:
texture = self.sixteenBlockTex
# textured cube faces
GL.glEnable(GL.GL_BLEND)
GL.glEnable(GL.GL_DEPTH_TEST)
GL.glDepthMask(False)
# edges within terrain
GL.glDepthFunc(GL.GL_GREATER)
try:
GL.glColor(color[0], color[1], color[2], max(color[3], 0.35))
except IndexError:
raise
GL.glLineWidth(1.0)
mceutils.drawCube(box, cubeType=GL.GL_LINE_STRIP)
# edges on or outside terrain
GL.glDepthFunc(GL.GL_LEQUAL)
GL.glColor(color[0], color[1], color[2], max(color[3] * 2, 0.75))
GL.glLineWidth(2.0)
mceutils.drawCube(box, cubeType=GL.GL_LINE_STRIP)
GL.glDepthFunc(GL.GL_LESS)
GL.glColor(color[0], color[1], color[2], color[3])
GL.glDepthFunc(GL.GL_LEQUAL)
mceutils.drawCube(box, texture=texture, selectionBox=True)
GL.glDepthMask(True)
GL.glDisable(GL.GL_BLEND)
GL.glDisable(GL.GL_DEPTH_TEST)
示例7: drawPlane
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glLineWidth [as 别名]
def drawPlane(ndivs=100, ndivsize=1):
# Plane parallel to x-z at origin with normal -y
minx = -ndivs*ndivsize
minz = -ndivs*ndivsize
maxx = ndivs*ndivsize
maxz = ndivs*ndivsize
gl.glLineWidth(1)
gl.glColor3f(0.7,0.7,1.0)
gl.glBegin(gl.GL_LINES)
for n in range(2*ndivs):
gl.glVertex3f(minx+ndivsize*n,0,minz)
gl.glVertex3f(minx+ndivsize*n,0,maxz)
gl.glVertex3f(minx,0,minz+ndivsize*n)
gl.glVertex3f(maxx,0,minz+ndivsize*n)
gl.glEnd()