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


Python GL.glVertex3fv方法代码示例

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


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

示例1: arcdraw

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glVertex3fv [as 别名]
    def arcdraw(self, x, n, radius, colxf=None):

        # determine scale and rotation of template
        import math
        sz=0.0
        y = [0, 0, 0]
        for i in (0,1,2):
            y[i] = x[i]+n[i]
        for i in (0,1,2):
            sz=sz+(x[i]-y[i])*(x[i]-y[i])
        sz = sqrt(sz)
        if sz==0.0:
            return
        rx = -180.0*acos((y[2]-x[2])/sz)/pi
        rz = -180.0*atan2(y[0]-x[0],y[1]-x[1])/pi

        GL.glPushMatrix()
        GL.glTranslatef(float(x[0]),float(x[1]),float(x[2]))
        if rz<=180.0 and rz >=-180.0:
            GL.glRotatef(float(rz), 0., 0., 1.)
        GL.glRotatef(float(rx), 1., 0., 0.)
        GL.glScalef(float(radius),float(radius),float(sz))

        # draw circle
        GL.glColor4fv(colxf)
        GL.glBegin(GL.GL_LINE_STRIP)
        for i in range(self.nsegments+1):
            GL.glVertex3fv(self.v[i])

        GL.glEnd()

        GL.glPopMatrix()
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:34,代码来源:Arcs3D.py

示例2: drawpolygons

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glVertex3fv [as 别名]
 def drawpolygons(self):
     g = self.geom
     vertices = g.getVertices()
     faces = g.getFaces()
     normals = g.getFNormals()
     GL.glDisable(GL.GL_CULL_FACE)
     for i,f in enumerate(faces):
         GL.glBegin(GL.GL_POLYGON)
         GL.glNormal3fv(normals[i])
         for vi in f:
             GL.glVertex3fv(vertices[vi])
         GL.glEnd()
         i+=1
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:15,代码来源:csgClip.py

示例3: Draw

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glVertex3fv [as 别名]
    def Draw(self):
        if __debug__:
         if hasattr(DejaVu, 'functionName'): DejaVu.functionName()

         GL.glEnable(GL.GL_AUTO_NORMAL)
         GL.glEnable(GL.GL_NORMALIZE)
         
         if self.theNurb is None:         
             self.theNurb = GLU.gluNewNurbsRenderer()

             GLU.gluNurbsProperty(self.theNurb, GLU.GLU_SAMPLING_TOLERANCE,
                                  25.0)
             GLU.gluNurbsProperty(self.theNurb, GLU.GLU_DISPLAY_MODE,
                                  GLU.GLU_OUTLINE_POLYGON)
             GLU.gluNurbsCallback(self.theNurb, GLU.GLU_ERROR, self.nurbsError)

         GLU.gluBeginSurface(self.theNurb)
         _glulib.gluNurbsSurface( self.theNurb,
                                  8, self.knots,
                                  8, self.knots,
                                  4*3,
                                  3,
                                  self.ctlpoints,
                                  4, 4,
                                  GL.GL_MAP2_VERTEX_3)

         GLU.gluEndSurface(self.theNurb)

         
         GL.glPointSize(5.0)
         GL.glDisable(GL.GL_LIGHTING)
         GL.glColor3f(1.0, 1.0, 0.0)
         GL.glBegin(GL.GL_POINTS)
         for i in range(4):
             for j in range(4):
                 GL.glVertex3fv(self.ctlpoints[i][j]) 

         GL.glEnd()
         GL.glDisable(GL.GL_AUTO_NORMAL)
         GL.glDisable(GL.GL_NORMALIZE)
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:42,代码来源:Nurbs.py

示例4: drawLegendLabelName

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glVertex3fv [as 别名]

#.........这里部分代码省略.........
        labelColor2 = (.5, .5, .5)
    else:
        labelColor2 = labelColor

    GL.glMatrixMode(GL.GL_PROJECTION)
    GL.glPushMatrix()
    GL.glLoadIdentity()
    if tile is None:
        GL.glOrtho(0, float(fullWidth), 0, float(fullHeight), -1, 1)
    else:
        GL.glOrtho(float(tile[0]), float(tile[1]), float(tile[2]), float(tile[3]), -1, 1)
    GL.glMatrixMode(GL.GL_MODELVIEW)
    GL.glPushMatrix()
    GL.glLoadIdentity()
    GL.glDisable( GL.GL_LIGHTING )

    GL.glPolygonMode(GL.GL_FRONT, GL.GL_FILL )
    
    if len(backgroundColor) == 4:
        GL.glEnable(GL.GL_BLEND)
        GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)

    #because of an unexplained bug on michel's laptop,
    #we don't draw the background when there is no frame 
    #(so michel has a way to manage the legend)
    if frame is True:
        #draw transparent background
        GL.glDepthMask(GL.GL_FALSE) 
        if len(backgroundColor) == 3:
            GL.glColor3fv(backgroundColor)
        else:
            GL.glColor4fv(backgroundColor)           
        GL.glBegin(GL.GL_QUADS)
        GL.glVertex3fv(lPt1)
        GL.glVertex3fv(lPt2)
        GL.glVertex3fv(lPt3)
        GL.glVertex3fv(lPt4)
        GL.glEnd()
        GL.glDepthMask(GL.GL_TRUE) 

    #draw frame
    if frame is True:
        GL.glPolygonMode(GL.GL_FRONT, GL.GL_LINE )
        GL.glLineWidth(1)
        GL.glColor3fv(labelColor2)    
        GL.glBegin(GL.GL_QUADS)
        GL.glVertex3fv(lPt1)
        GL.glVertex3fv(lPt2)
        GL.glVertex3fv(lPt3)
        GL.glVertex3fv(lPt4)
        GL.glEnd()
        GL.glPolygonMode(GL.GL_FRONT, GL.GL_FILL)
    
    if mini is not None and maxi is not None and maxi > mini:
        lUnitStep = legendLongSide/float(maxi-mini)
    else:
        lUnitStep = legendLongSide
    
    GL.glDisable( GL.GL_LIGHTING )

    if verticalLegend is True:
        if leftOrBelowLabels is True:
            lRoomLeftToLabel = -fontScaleHalf + lRoomToLegendCloseLongSide
            lRoomLeftToName = -fontScaleHalf + lRoomToLegendFarLongSide - lNameWidth
            lRoomLeftToUnit = -fontScaleHalf + lRoomToLegendFarLongSide - lUnitWidth
            lRoomBelowName = -fontScaleHalf + roomBelowLegend - lMaxLabelsHeight - lNameHeight
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:70,代码来源:Legend.py

示例5: Draw

# 需要导入模块: from opengltk.OpenGL import GL [as 别名]
# 或者: from opengltk.OpenGL.GL import glVertex3fv [as 别名]
    def Draw(self):
        for i in xrange(len(self.vertexSet)):
            if len(self.radii)==1:
                rad = self.radii[0]
            else:
                rad = self.radii[i]
            if len(self.angles)==1:
                ang = self.angles[0]
            else:
                ang = self.angles[i]

            vx, vy, vz = norm = self.vertexSet.normals.array[i]
            if self.vectors is None:
                # get orthogonal vector
                dx, dy, dz = fabs(vx), fabs(vy), fabs(vz)
                mini= min( [dx, dy, dz] )
                if mini==dx:
                    nov = 1./sqrt( vz*vz+ vy*vy )
                    ovx = 0.
                    ovy = -vz*nov
                    ovz =  vy*nov
                elif mini==dy:
                    nov = 1./sqrt( vz*vz+ vx*vx )
                    ovx = -vz*nov
                    ovy = 0.
                    ovz = vx*nov
                else:
                    nov = 1./sqrt( vy*vy+ vx*vx )
                    ovx = -vy*nov
                    ovy = vx*nov
                    ovz = 0.
                vec = [ovx, ovy, ovz]

            elif len(self.vectors)==1:
                vec = self.vectors[0]
            else:
                vec = self.vectors[i]

            angRad = ang*pi*0.00555555555556
            nsegments = int(ang/self.degreesPerSegment) + 1
            d = angRad / nsegments # increment
            a = 0		   # starting angle
            
            GL.glNormal3fv(norm.astype('f'))
            GL.glPushName(i)
            GL.glBegin(GL.GL_TRIANGLE_FAN)
            if self.materials[GL.GL_FRONT].binding[0]==viewerConst.PER_VERTEX:
                col = self.materials[GL.GL_FRONT].prop[0]
                GL.glColor4fv(col[i])
            center = Numeric.array(self.vertexSet.vertices.array[i])
            vec = Numeric.array(vec).astype('f')
            #vec = vec/sqrt(Numeric.sum(vec*vec))
            vec2 = Numeric.zeros(3, 'f')
            vec2[0] = vec[1]*norm[2] - vec[2]*norm[1]
            vec2[1] = vec[2]*norm[0] - vec[0]*norm[2]
            vec2[2] = vec[0]*norm[1] - vec[1]*norm[0]
            GL.glVertex3fv(center)
            for j in range(nsegments+1):
                p = center + cos(a)*vec*rad + sin(a)*vec2*rad
                GL.glVertex3fv(p.astype('f'))
                a = a+d
            GL.glEnd()
            GL.glPopName()
        return 1
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:66,代码来源:Arcs3D.py


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