当前位置: 首页>>代码示例>>Python>>正文


Python GL.glLineWidth方法代码示例

本文整理汇总了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) 
开发者ID:spectralpython,项目名称:spectral,代码行数:27,代码来源:ndwindow.py

示例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) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:24,代码来源:renderer.py

示例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) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:21,代码来源:mceutils.py

示例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() 
开发者ID:luigifreda,项目名称:pyslam,代码行数:18,代码来源:viewer3D.py

示例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) 
开发者ID:Podshot,项目名称:MCEdit-Unified,代码行数:24,代码来源:renderer.py

示例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) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:34,代码来源:leveleditor.py

示例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() 
开发者ID:luigifreda,项目名称:pyslam,代码行数:17,代码来源:simpleDraw.py


注:本文中的OpenGL.GL.glLineWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。