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


Python GL.GL_DEPTH_BUFFER_BIT属性代码示例

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


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

示例1: render_rgb_indexed_colors

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def render_rgb_indexed_colors(self, **kwargs):
        '''Draws scene in the background buffer to extract mouse click info'''
        import OpenGL.GL as gl
        import OpenGL.GLU as glu
        gl.glMatrixMode(gl.GL_MODELVIEW)
        gl.glLoadIdentity()
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)

        # camera_pos_rtp is relative to the target position. To get the
        # absolute camera position, we need to add the target position.
        gl.glPushMatrix()
        camera_pos_xyz = np.array(rtp_to_xyz(*self.camera_pos_rtp)) \
            + self.target_pos
        glu.gluLookAt(
            *(list(camera_pos_xyz) + list(self.target_pos) + self.up))
        self.draw_data_set()
        gl.glPopMatrix()
        gl.glFlush() 
开发者ID:spectralpython,项目名称:spectral,代码行数:20,代码来源:ndwindow.py

示例2: paintGL

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def paintGL(self):
        self.makeCurrent()
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)

        self.program.bind()

        self.program.enableAttributeArray("position")
        self.vbo.bind()
        gl.glVertexAttribPointer(self.program.attributeLocation("position"), 2, gl.GL_FLOAT, gl.GL_FALSE, 0, self.vbo)


        self.program.enableAttributeArray("normal")
        self.vbo_cols.bind()
        gl.glVertexAttribPointer(self.program.attributeLocation("normal"), 3, gl.GL_FLOAT, gl.GL_FALSE, 0, self.vbo_cols)


        gl.glDrawArrays(gl.GL_TRIANGLES, 0, len(self.data))



        print(self.context().format().majorVersion())
        print(self.context().format().minorVersion())


        print(gl.glGetString(gl.GL_VERSION)); 
开发者ID:maweigert,项目名称:spimagine,代码行数:27,代码来源:test_opengl.py

示例3: paintGL

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def paintGL(self):
        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
        GL.glLoadIdentity()
        GL.glTranslated(0.0, 0.0, -10.0)
        GL.glRotated(self.xRot / 16.0, 1.0, 0.0, 0.0)
        GL.glRotated(self.yRot / 16.0, 0.0, 1.0, 0.0)
        GL.glRotated(self.zRot / 16.0, 0.0, 0.0, 1.0)
        GL.glScalef(self.zoom,self.zoom,self.zoom)

        GL.glCallList(self.electrode_object)
        GL.glCallList(self.center_dir)
        if self.plug_object != 0:
            GL.glCallList(self.plug_object) 
开发者ID:simnibs,项目名称:simnibs,代码行数:15,代码来源:electrodeGUI.py

示例4: viewer_refresh

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def viewer_refresh(self, q):
    while not q.empty():
      self.state = q.get()

    gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
    gl.glClearColor(0.0, 0.0, 0.0, 1.0)
    self.dcam.Activate(self.scam)

    if self.state is not None:
      if self.state[0].shape[0] >= 2:
        # draw poses
        gl.glColor3f(0.0, 1.0, 0.0)
        pangolin.DrawCameras(self.state[0][:-1])

      if self.state[0].shape[0] >= 1:
        # draw current pose as yellow
        gl.glColor3f(1.0, 1.0, 0.0)
        pangolin.DrawCameras(self.state[0][-1:])

      if self.state[1].shape[0] != 0:
        # draw keypoints
        gl.glPointSize(5)
        gl.glColor3f(1.0, 0.0, 0.0)
        pangolin.DrawPoints(self.state[1], self.state[2])

    pangolin.FinishFrame() 
开发者ID:geohot,项目名称:twitchslam,代码行数:28,代码来源:display.py

示例5: main

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def main():
    pangolin.CreateWindowAndBind('Main', 640, 480)
    gl.glEnable(gl.GL_DEPTH_TEST)

    # Define Projection and initial ModelView matrix
    scam = pangolin.OpenGlRenderState(
        pangolin.ProjectionMatrix(640, 480, 420, 420, 320, 240, 0.2, 100),
        pangolin.ModelViewLookAt(-2, 2, -2, 0, 0, 0, pangolin.AxisDirection.AxisY))
    handler = pangolin.Handler3D(scam)

    # Create Interactive View in window
    dcam = pangolin.CreateDisplay()
    dcam.SetBounds(0.0, 1.0, 0.0, 1.0, -640.0/480.0)
    dcam.SetHandler(handler)
    dcam.Resize(pangolin.Viewport(0,0,640*2,480*2))

    while not pangolin.ShouldQuit():
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
        gl.glClearColor(1.0, 1.0, 1.0, 1.0)
        dcam.Activate(scam)
        
        # Render OpenGL Cube
        pangolin.glDrawColouredCube()

        # Draw Point Cloud
        points = np.random.random((100000, 3)) * 10
        colors = np.zeros((len(points), 3))
        colors[:, 1] = 1 -points[:, 0] / 10.
        colors[:, 2] = 1 - points[:, 1] / 10.
        colors[:, 0] = 1 - points[:, 2] / 10.

        gl.glPointSize(2)
        gl.glColor3f(1.0, 0.0, 0.0)
        # access numpy array directly(without copying data), array should be contiguous.
        pangolin.DrawPoints(points, colors)    

        pangolin.FinishFrame() 
开发者ID:geohot,项目名称:twitchslam,代码行数:39,代码来源:HelloPangolin.py

示例6: render

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

示例7: display

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def display():
        gl.glClear (gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
        glut.glutSwapBuffers() 
开发者ID:fabioz,项目名称:PyDev.Debugger,代码行数:5,代码来源:gui-glut.py

示例8: on_paint

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

示例9: paintGL

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def paintGL(self):
        if self.opengl:
            GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
            self.opengl.draw(self.defaultFramebufferObject(), self.width(), -self.height()) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:6,代码来源:mpvwidget.py

示例10: gl_clear

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def gl_clear(self):
        from OpenGL import GL
        
        bg = self.bg_color
        if bg:
            r = bg[0] / 255.0
            g = bg[1] / 255.0
            b = bg[2] / 255.0
            GL.glClearColor(r, g, b, 0.0)
        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:12,代码来源:root.py

示例11: paintGL

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def paintGL(self):
        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
        GL.glLoadIdentity()
        GL.glTranslated(0.0, 0.0, -10.0)
        GL.glRotated(self.xRot / 16.0, 1.0, 0.0, 0.0)
        GL.glRotated(self.yRot / 16.0, 0.0, 1.0, 0.0)
        GL.glRotated(self.zRot / 16.0, 0.0, 0.0, 1.0)
        GL.glCallList(self.object) 
开发者ID:dragondjf,项目名称:PFramer,代码行数:10,代码来源:opengl_test.py

示例12: paintGL

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def paintGL(self):
        self.makeCurrent()
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)

        self.program.bind()

        self.program.enableAttributeArray("position")
        self.vbo.bind()
        gl.glVertexAttribPointer(self.program.attributeLocation("position"), 2, gl.GL_FLOAT, gl.GL_FALSE, 0, self.vbo)


        self.program.enableAttributeArray("color")
        self.vbo_cols.bind()
        gl.glVertexAttribPointer(self.program.attributeLocation("color"), 3, gl.GL_FLOAT, gl.GL_FALSE, 0, self.vbo_cols)

        self.vbo_index.bind()

        #gl.glDrawArrays(gl.GL_TRIANGLES, 0, len(self.data))

        gl.glDrawElements(gl.GL_TRIANGLES, len(self.index), gl.GL_UNSIGNED_INT, None)

        print(self.context().format().majorVersion())
        print(self.context().format().minorVersion())


        print(gl.glGetString(gl.GL_VERSION)); 
开发者ID:maweigert,项目名称:spimagine,代码行数:28,代码来源:test_opengl2.py

示例13: main

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def main():
    # Create OpenGL window in single line
    pangolin.CreateWindowAndBind('Main', 640, 480)

    # Data logger object
    log = pangolin.DataLog()

    # Optionally add named labels
    labels = ['sin(t)', 'cos(t)', 'sin(t)+cos(t)']
    log.SetLabels(labels)

    # OpenGL 'view' of data. We might have many views of the same data.
    tinc = 0.03
    plotter = pangolin.Plotter(log, 0.0, 4.0*np.pi/tinc, -2.0, 2.0, np.pi/(4*tinc), 0.5)
    plotter.SetBounds(0.0, 1.0, 0.0, 1.0)
    plotter.Track('$i')

    # Add some sample annotations to the plot
    plotter.AddMarker(pangolin.Marker.Vertical, -1000, pangolin.Marker.LessThan, 
        pangolin.Colour.Blue().WithAlpha(0.2))
    plotter.AddMarker(pangolin.Marker.Horizontal, 100, pangolin.Marker.GreaterThan, 
        pangolin.Colour.Red().WithAlpha(0.2))
    plotter.AddMarker(pangolin.Marker.Horizontal,  10, pangolin.Marker.Equal, 
        pangolin.Colour.Green().WithAlpha(0.2))

    pangolin.DisplayBase().AddDisplay(plotter)


    t = 0
    while not pangolin.ShouldQuit():
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)

        log.Log(np.sin(t), np.cos(t), np.sin(t)+np.cos(t))
        t += tinc

        pangolin.FinishFrame() 
开发者ID:luigifreda,项目名称:pyslam,代码行数:38,代码来源:simplePlot.py

示例14: main

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def main():
    pangolin.CreateWindowAndBind('Main', 640, 480)
    gl.glEnable(gl.GL_DEPTH_TEST)

    # Define Projection and initial ModelView matrix
    scam = pangolin.OpenGlRenderState(
        pangolin.ProjectionMatrix(640, 480, 420, 420, 320, 240, 0.2, 100),
        pangolin.ModelViewLookAt(-2, 2, -2, 0, 0, 0, pangolin.AxisY))

    tree = pangolin.Renderable()
    tree.Add(pangolin.Axis())

    # Create Interactive View in window
    handler = pangolin.SceneHandler(tree, scam)
    dcam = pangolin.CreateDisplay()
    dcam.SetBounds(0.0, 1.0, 0.0, 1.0, -640.0 /480.0)
    dcam.SetHandler(handler)

    def draw(view):
        view.Activate(scam)
        tree.Render()
    dcam.SetDrawFunction(draw)

    while not pangolin.ShouldQuit():
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)

        # or
        # dcam.Activate(scam)
        # tree.Render()

        pangolin.FinishFrame() 
开发者ID:luigifreda,项目名称:pyslam,代码行数:33,代码来源:simpleScene.py

示例15: main

# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_DEPTH_BUFFER_BIT [as 别名]
def main():
    pangolin.CreateWindowAndBind('Main', 640, 480)
    gl.glEnable(gl.GL_DEPTH_TEST)

    # Define Projection and initial ModelView matrix
    scam = pangolin.OpenGlRenderState(
        pangolin.ProjectionMatrix(640, 480, 420, 420, 320, 240, 0.2, 100),
        pangolin.ModelViewLookAt(-2, 2, -2, 0, 0, 0, pangolin.AxisDirection.AxisY))
    handler = pangolin.Handler3D(scam)

    # Create Interactive View in window
    dcam = pangolin.CreateDisplay()
    dcam.SetBounds(0.0, 1.0, 0.0, 1.0, -640.0/480.0)
    dcam.SetHandler(handler)

    while not pangolin.ShouldQuit():
        gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
        gl.glClearColor(1.0, 1.0, 1.0, 1.0)
        dcam.Activate(scam)
        
        # Render OpenGL Cube
        pangolin.glDrawColouredCube()

        # Draw Point Cloud
        points = np.random.random((100000, 3)) * 10
        colors = np.zeros((len(points), 3))
        colors[:, 1] = 1 -points[:, 0] / 10.
        colors[:, 2] = 1 - points[:, 1] / 10.
        colors[:, 0] = 1 - points[:, 2] / 10.

        gl.glPointSize(2)
        gl.glColor3f(1.0, 0.0, 0.0)
        # access numpy array directly(without copying data), array should be contiguous.
        pangolin.DrawPoints(points, colors)    

        pangolin.FinishFrame() 
开发者ID:luigifreda,项目名称:pyslam,代码行数:38,代码来源:helloPangolin.py


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