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


Python GL.glDisable方法代码示例

本文整理汇总了Python中OpenGL.GL.glDisable方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glDisable方法的具体用法?Python GL.glDisable怎么用?Python GL.glDisable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenGL.GL的用法示例。


在下文中一共展示了GL.glDisable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: renderImage

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def renderImage(self, context):
        width, height = self.getSize()
        gl.glViewport(0, 0, width, height)

        gl.glDisable(gl.GL_SCISSOR_TEST)

        gl.glEnable(gl.GL_ALPHA_TEST)
        gl.glAlphaFunc(gl.GL_GREATER, 0)

        gl.glEnable(gl.GL_BLEND)
        gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)

        self.frameBuffer.bind()

        self.renderer.render(context)

        self.frameBuffer.unbind()

        #TODO Restore blend state. Any other states that need restoring...?
        gl.glBlendFunc(gl.GL_ONE, gl.GL_ONE_MINUS_SRC_ALPHA) 
开发者ID:bitsawer,项目名称:renpy-shader,代码行数:22,代码来源:controller.py

示例2: draw_box

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [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

示例3: initgl

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def initgl(self):
        '''App-specific initialization for after GLUT has been initialized.'''
        import OpenGL.GL as gl
        self.gllist_id = gl.glGenLists(9)
        gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
        gl.glEnableClientState(gl.GL_COLOR_ARRAY)
        gl.glDisable(gl.GL_LIGHTING)
        gl.glDisable(gl.GL_TEXTURE_2D)
        gl.glDisable(gl.GL_FOG)
        gl.glDisable(gl.GL_COLOR_MATERIAL)
        gl.glEnable(gl.GL_DEPTH_TEST)
        gl.glShadeModel(gl.GL_FLAT)
        self.set_data(self.data, classes=self.classes, features=self.features)

        try:
            import OpenGL.GLUT as glut
            glut.glutInit()
            self._have_glut = True
        except:
            pass 
开发者ID:spectralpython,项目名称:spectral,代码行数:22,代码来源:ndwindow.py

示例4: drawTerrainCuttingWire

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [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

示例5: _drawCeiling

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def _drawCeiling():
        lines = []
        minz = minx = -256
        maxz = maxx = 256
        for x in range(minx, maxx + 1, 16):
            lines.append((x, 0, minz))
            lines.append((x, 0, maxz))
        for z in range(minz, maxz + 1, 16):
            lines.append((minx, 0, z))
            lines.append((maxx, 0, z))

        GL.glColor(0.3, 0.7, 0.9)
        GL.glVertexPointer(3, GL.GL_FLOAT, 0, numpy.array(lines, dtype='float32'))

        GL.glEnable(GL.GL_DEPTH_TEST)
        GL.glDepthMask(False)
        GL.glDrawArrays(GL.GL_LINES, 0, len(lines))
        GL.glDisable(GL.GL_DEPTH_TEST)
        GL.glDepthMask(True) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:21,代码来源:camera.py

示例6: drawToolReticle

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def drawToolReticle(self):
        if self.movingPlayer is None:
            return

        pos, direction = self.editor.blockFaceUnderCursor
        dim = self.editor.level.getPlayerDimension(self.movingPlayer)
        pos = (pos[0], pos[1] + 2, pos[2])

        x, y, z = pos

        # x,y,z=map(lambda p,d: p+d, pos, direction)
        GL.glEnable(GL.GL_BLEND)
        GL.glColor(1.0, 1.0, 1.0, 0.5)
        self.drawCharacterHead(x + 0.5, y + 0.75, z + 0.5, self.revPlayerPos[dim][self.movingPlayer], dim)
        GL.glDisable(GL.GL_BLEND)

        GL.glEnable(GL.GL_DEPTH_TEST)
        self.drawCharacterHead(x + 0.5, y + 0.75, z + 0.5, self.revPlayerPos[dim][self.movingPlayer], dim)
        drawTerrainCuttingWire(BoundingBox((x, y, z), (1, 1, 1)))
        drawTerrainCuttingWire(BoundingBox((x, y - 1, z), (1, 1, 1)))
        #drawTerrainCuttingWire( BoundingBox((x,y-2,z), (1,1,1)) )
        GL.glDisable(GL.GL_DEPTH_TEST) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:24,代码来源:player.py

示例7: _drawToolMarkers

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def _drawToolMarkers(self):
        x, y, z = self.editor.level.playerSpawnPosition()
        
        GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
        GL.glEnable(GL.GL_BLEND);
        
        color = config.selectionColors.black.get() + (0.35,)
        GL.glColor(*color)
        GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
        GL.glLineWidth(2.0)
        drawCube(FloatBox((x, y, z), (1, 1, 1)))
        GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)
        drawCube(FloatBox((x, y, z), (1, 1, 1)))
        GL.glDisable(GL.GL_BLEND)
        
        GL.glEnable(GL.GL_DEPTH_TEST)
        GL.glColor(1.0, 1.0, 1.0, 1.0)
        self.drawCage(x, y, z)
        self.drawCharacterHead(x + 0.5, y + 0.5 + 0.125 * numpy.sin(self.editor.frames * 0.05), z + 0.5)
        GL.glDisable(GL.GL_DEPTH_TEST) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:22,代码来源:player.py

示例8: render_companion_window

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def render_companion_window(self):
        GL.glDisable(GL.GL_DEPTH_TEST)
        GL.glViewport(0, 0, self.companion_width, self.companion_height)
        GL.glBindVertexArray(self.companion_window_vao)
        GL.glUseProgram(self.companion_window_program)
        # render left eye (first half of index array)
        i_size = sizeof(c_uint16)
        count = int(self.companion_window_index_size / 2)
        GL.glBindTexture(GL.GL_TEXTURE_2D, self.left_eye_desc.resolve_texture_id)
        GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE)
        GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE)
        GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR)
        GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR)
        GL.glDrawElements(GL.GL_TRIANGLES, count, GL.GL_UNSIGNED_SHORT, cast(0 * i_size, c_void_p))
        # render right eye (second half of index array)
        GL.glBindTexture(GL.GL_TEXTURE_2D, self.right_eye_desc.resolve_texture_id)
        GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE)
        GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE)
        GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR)
        GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR)
        GL.glDrawElements(GL.GL_TRIANGLES, count, GL.GL_UNSIGNED_SHORT, cast(count * i_size, c_void_p))
        GL.glBindVertexArray(0)
        GL.glUseProgram(0) 
开发者ID:cmbruns,项目名称:pyopenvr,代码行数:25,代码来源:hellovr_glfw.py

示例9: __init__

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def __init__(self, obj_info, color=None, swapyz=False):
        """Loads a Wavefront OBJ file. """
        self.vertices = obj_info.vertices
        self.normals = obj_info.normals
        self.texcoords = obj_info.texcoords
        self.faces = obj_info.faces
        self.color = color

        self.gl_list = GL.glGenLists(1)
        GL.glNewList(self.gl_list, GL.GL_COMPILE)
        # GL.glEnable(GL.GL_TEXTURE_2D)
        GL.glFrontFace(GL.GL_CCW)
        # GL.glDisable(GL.GL_LIGHT0)
        # GL.glDisable(GL.GL_LIGHTING)
        for face in self.faces:
            vertices, normals, _, _ = face
            GL.glColor3f(self.color[0], self.color[1], self.color[2])
            GL.glBegin(GL.GL_POLYGON)
            for i in range(len(vertices)):
                # if normals[i] > 0:
                #     GL.glNormal3fv(self.normals[normals[i] - 1])
                GL.glVertex3fv(self.vertices[vertices[i] - 1])
            GL.glEnd()
        GL.glDisable(GL.GL_TEXTURE_2D)
        GL.glEndList() 
开发者ID:thusiyuan,项目名称:holistic_scene_parsing,代码行数:27,代码来源:render_scene.py

示例10: _drawCeiling

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def _drawCeiling():
        lines = []
        minz = minx = -256
        maxz = maxx = 256
        append = lines.append
        for x in xrange(minx, maxx + 1, 16):
            append((x, 0, minz))
            append((x, 0, maxz))
        for z in xrange(minz, maxz + 1, 16):
            append((minx, 0, z))
            append((maxx, 0, z))

        GL.glColor(0.3, 0.7, 0.9)
        GL.glVertexPointer(3, GL.GL_FLOAT, 0, numpy.array(lines, dtype='float32'))

        GL.glEnable(GL.GL_DEPTH_TEST)
        GL.glDepthMask(False)
        GL.glDrawArrays(GL.GL_LINES, 0, len(lines))
        GL.glDisable(GL.GL_DEPTH_TEST)
        GL.glDepthMask(True) 
开发者ID:Podshot,项目名称:MCEdit-Unified,代码行数:22,代码来源:camera.py

示例11: _drawToolMarkers

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def _drawToolMarkers(self):
        x, y, z = self.editor.level.playerSpawnPosition()
        
        GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
        GL.glEnable(GL.GL_BLEND)
        
        color = config.selectionColors.black.get() + (0.35,)
        GL.glColor(*color)
        GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
        GL.glLineWidth(2.0)
        drawCube(FloatBox((x, y, z), (1, 1, 1)))
        GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)
        drawCube(FloatBox((x, y, z), (1, 1, 1)))
        GL.glDisable(GL.GL_BLEND)
        
        GL.glEnable(GL.GL_DEPTH_TEST)
        GL.glColor(1.0, 1.0, 1.0, 1.0)
        self.drawCage(x, y, z)
        self.drawCharacterHead(x + 0.5, y + 0.5 + 0.125 * numpy.sin(self.editor.frames * 0.05), z + 0.5)
        GL.glDisable(GL.GL_DEPTH_TEST) 
开发者ID:Podshot,项目名称:MCEdit-Unified,代码行数:22,代码来源:player.py

示例12: drawEEGPositions

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def drawEEGPositions(self, points, names):
        genList = GL.glGenLists(1)
        GL.glNewList(genList, GL.GL_COMPILE)
        for point, name in zip(points, names):
            normal = self.skin_surf.projectPoint(point, smooth=False)[1]
            if normal is None or normal == []or point is None or point == []:
                print('Invalid Point!')
            else:
                u, v = self.skin_surf.getTangentCoordinates(normal)
                pos_el = point + 2*normal
                GL.glEnable(GL.GL_LIGHTING)
                self.qglColor(GREEN)
                self.ellipse(pos_el, normal, u, v, [6, 6])
                if bool(GLUT.glutBitmapString):
                    pos_text = point + 5*normal
                    GL.glDisable(GL.GL_LIGHTING)
                    GL.glColor3f(0.0, 0.0, 0.0)
                    GL.glRasterPos3f(*pos_text)
                    GLUT.glutBitmapString(
                        GLUT.GLUT_BITMAP_HELVETICA_12,
                        name.encode())
                    GL.glEnable(GL.GL_LIGHTING)

        GL.glEndList()
        self.eegPositions = genList
        self.update() 
开发者ID:simnibs,项目名称:simnibs,代码行数:28,代码来源:head_model_OGL.py

示例13: render

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def render(self, context):
        self.shader.bind()

        gl.glDisable(gl.GL_BLEND)
        gl.glEnable(gl.GL_DEPTH_TEST)

        gl.glClearDepth(1.0)
        gl.glClearColor(*self.clearColor)
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)

        view, projection = createDefaultMatrices(self.width, self.height, context)
        self.shader.uniformMatrix4f(shader.VIEW_MATRIX, view)
        self.shader.uniformMatrix4f(shader.PROJ_MATRIX, projection)

        self.setUniforms(self.shader, context.uniforms)

        for tag, entry in self.models.items():
            mesh = entry.mesh

            entry.textureMap.bindTextures(self.shader)

            self.shader.uniformMatrix4f(shader.WORLD_MATRIX, entry.matrix)

            self.bindAttributeArray(self.shader, "inPosition", mesh.vertices, 3)
            self.bindAttributeArray(self.shader, "inNormal", mesh.normals, 3)
            self.bindAttributeArray(self.shader, "inUv", mesh.uvs, 2)
            gl.glDrawArrays(gl.GL_TRIANGLES, 0, len(mesh.vertices) // 3)
            self.unbindAttributeArray(self.shader, "inPosition")
            self.unbindAttributeArray(self.shader, "inNormal")
            self.unbindAttributeArray(self.shader, "inUv")

            entry.textureMap.unbindTextures()

        gl.glEnable(gl.GL_BLEND)
        gl.glDisable(gl.GL_DEPTH_TEST)

        self.shader.unbind() 
开发者ID:bitsawer,项目名称:renpy-shader,代码行数:39,代码来源:rendering.py

示例14: on_paint

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [as 别名]
def on_paint(self, event):
        """Process the drawing event."""
        import OpenGL.GL as gl
        import OpenGL.GLU as glu
        self.canvas.SetCurrent(self.canvas.context)

        if not self.gl_initialized:
            self.initgl()
            self.gl_initialized = True
            self.print_help()

        if self.light:
            gl.glEnable(gl.GL_LIGHTING)
        else:
            gl.glDisable(gl.GL_LIGHTING)

        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
        gl.glLoadIdentity()
        gl.glPushMatrix()
        glu.gluLookAt(*(list(rtp_to_xyz(
            *self.camera_pos_rtp)) + list(self.target_pos) + list(self.up)))

        self.draw_cube()

        gl.glPopMatrix()
        gl.glFlush()
        self.SwapBuffers()
        event.Skip() 
开发者ID:spectralpython,项目名称:spectral,代码行数:30,代码来源:hypercube.py

示例15: drawConstructionCube

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glDisable [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


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