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


Python gl.glColor3f函数代码示例

本文整理汇总了Python中pyglet.gl.glColor3f函数的典型用法代码示例。如果您正苦于以下问题:Python glColor3f函数的具体用法?Python glColor3f怎么用?Python glColor3f使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: flush_labels

 def flush_labels(self):
     gl.glClear(gl.GL_DEPTH_BUFFER_BIT)
     gl.glPushMatrix()
     gl.glTranslatef(-self.game.camera_x * defs.WINDOW_SCALE[0],
                     -self.game.camera_y * defs.WINDOW_SCALE[1], 0)
     for label, x, y, scale in self.labels:
         if scale:
             gl.glPushMatrix()
             label.anchor_x = 'center'
             label.anchor_y = 'center'
             gl.glTranslatef(x * defs.WINDOW_SCALE[0],
                             y * defs.WINDOW_SCALE[1], 0)
             gl.glScalef(*scale)
             label.x = label.y = 0
             label.draw()
             gl.glPopMatrix()
         else:
             label.x = x * defs.WINDOW_SCALE[0]
             label.y = y * defs.WINDOW_SCALE[1]
             label.draw()
     self.labels = []
     gl.glColor3f(1, 1, 1)
     gl.glEnable(gl.GL_DEPTH_TEST)
     gl.glPopMatrix()
     # self.fps_label.draw()
     self.game.score.draw()
开发者ID:noonat,项目名称:deathbeam,代码行数:26,代码来源:draw.py

示例2: create_window

 def create_window(self, _iScr=0, _title="", _dx=0, _dy=0, _left=0, _top=0,
                   _scale=1.0, _isScrOvl=False, _iScrGUI=0, _offset=(0,0)):
   """ If the renderer was initialized, create a window instance and store
       it in the internal window list. For parameters, see Window class.
   """
   if self.isReady:
     self.winList.append(Window(self, _iScr, _title, _dx, _dy, _left, _top,
                                _scale, _isScrOvl, _iScrGUI, _offset))    
     '''
     if len(self.winList) == 1:
     # Is the first window, set some general OpenGL properties
     #
     '''
     GL.glClearColor(0., 0., 0., 0.)
     GL.glColor3f(1., 1., 1.)
     GL.glDisable(GL.GL_DEPTH_TEST)
     GL.glEnable(GL.GL_BLEND)
     GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
     '''
     GL.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
     GL.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
 
     GL.glShadeModel(GL_FLAT) # GL_FLAT or GL_SMOOTH
     GL.glEnable(GL_POINT_SMOOTH)
     '''
     return self.winList[-1]
   else:  
     return None
开发者ID:eulerlab,项目名称:QDSpy,代码行数:28,代码来源:renderer_opengl.py

示例3: _draw

    def _draw(self):
        corner = c = self.octree.corner
        w = self.octree.width

        gl.glPushAttrib( gl.GL_ENABLE_BIT )
        gl.glEnable( gl.GL_COLOR_MATERIAL )

        if self.octree._child_nodes is None:
            if self.list_id:
                gl.glCallList(self.list_id)
            else:
                self.list_id = gl.glGenLists(1)
                gl.glNewList(self.list_id, gl.GL_COMPILE)

                gl.glColor3f(*self.color)
                gl.glBegin(gl.GL_LINE_LOOP)
                gl.glVertex3f(*c)
                gl.glVertex3f(*(c + (0,w,0)))
                gl.glVertex3f(*(c + (0,w,w)))
                gl.glVertex3f(*(c + (0,0,w)))
                gl.glEnd()

                c = corner + (w,0,0)

                gl.glBegin(gl.GL_LINE_LOOP)
                gl.glVertex3f(*c)
                gl.glVertex3f(*(c + (0,w,0)))
                gl.glVertex3f(*(c + (0,w,w)))
                gl.glVertex3f(*(c + (0,0,w)))
                gl.glEnd()

                gl.glBegin(gl.GL_LINES)
                gl.glVertex3f(*c)
                gl.glVertex3f(*(c - (w,0,0)))
                gl.glVertex3f(*(c + (0,w,0)))
                gl.glVertex3f(*(corner + (0,w,0)))
                gl.glVertex3f(*(c + (0,w,w)))
                gl.glVertex3f(*(corner + (0,w,w)))
                gl.glVertex3f(*(c + (0,0,w)))
                gl.glVertex3f(*(corner + (0,0,w)))
                gl.glEnd()

                gl.glEndList()

        # This could be optimized of course
        if self.octree._child_nodes is not None:
            r = self.color[0] + 0.14
            if r < 1.0:
                r = r % 1.0
            else:
                r = 1.0
            b = max((self.color[2] - 0.14), 0)
            for node in self.octree._child_nodes.values():
                if not self._cache.has_key(id(node)):
                    self._cache[id(node)] = OctreeDebug(node, color=(r,0,b))
                debugNode = self._cache[id(node)]
                debugNode._draw()
        gl.glColor3f(1,1,1)

        gl.glPopAttrib()
开发者ID:Knio,项目名称:miru,代码行数:60,代码来源:trees.py

示例4: draw_block

def draw_block(block):
    transformed = [world_to_screen(block.GetWorldPoint(p)) for p in POINTS]
    gl.glColor3f(1.0, 0.1, 0)
    gl.glBegin(gl.GL_LINE_LOOP)
    for p in transformed:
        gl.glVertex2f(*p)
    gl.glEnd()
开发者ID:ChunyangSun,项目名称:VisionAndPhysicsEngine,代码行数:7,代码来源:demo1.py

示例5: draw

 def draw(self):
     gl.glColor3f(0, 0, 0)
     gl.glRectd(self._aabb.x, self._aabb.y, self._aabb.x+self._aabb.width,
             self._aabb.y+self._aabb.height)
     gl.glColor3f(*self.color)
     gl.glRectd(self._aabb.x+2, self._aabb.y+2,
             self._aabb.x+self._aabb.width-2, self._aabb.y+self._aabb.height-2)
开发者ID:kearnh,项目名称:pqrs,代码行数:7,代码来源:objects.py

示例6: draw

    def draw(self):
        self.loadStartPosition()
        gl.glRotatef(90.0, 0.0, 0.0, 1.0)
        gl.glBegin(gl.GL_QUADS)
        gl.glColor3f(1.0, 1.0, 0.0)
        tenth = math.pi * 2.0 / 10.0
        for z in [-0.1, 0.1]:
            for i in xrange(5):
                a = float(i) * tenth * 2.0
                gl.glVertex3f(0.0, 0.0, z)
                gl.glVertex3f(0.4 * math.cos(a - tenth), 0.4 * math.sin(a - tenth), z)
                gl.glVertex3f(math.cos(a), math.sin(a), z)
                gl.glVertex3f(0.4 * math.cos(a + tenth), 0.4 * math.sin(a + tenth), z)
        for i in xrange(5):
            a = float(i) * tenth * 2.0
            gl.glVertex3f(0.4 * math.cos(a - tenth), 0.4 * math.sin(a - tenth), 0.1)
            gl.glVertex3f(math.cos(a), math.sin(a), 0.1)
            gl.glVertex3f(math.cos(a), math.sin(a), -0.1)
            gl.glVertex3f(0.4 * math.cos(a - tenth), 0.4 * math.sin(a - tenth), -0.1)
            gl.glVertex3f(0.4 * math.cos(a + tenth), 0.4 * math.sin(a + tenth), 0.1)
            gl.glVertex3f(math.cos(a), math.sin(a), 0.1)
            gl.glVertex3f(math.cos(a), math.sin(a), -0.1)
            gl.glVertex3f(0.4 * math.cos(a + tenth), 0.4 * math.sin(a + tenth), -0.1)
        gl.glEnd()

        self.loadStartPosition()
        gl.glTranslatef(0.0, 0.0, 0.1)
        gl.glScalef(0.01, 0.01, 0.0)
        self.label.draw()

        gl.glLoadIdentity()
开发者ID:benatkin,项目名称:pyglet-stuff,代码行数:31,代码来源:goldstar.py

示例7: draw

	def draw(self, frame):
		# The gneneral plan here is:
		#  1. Get the dots in the range of 0-255.
		#  2. Create a texture with the dots data.
		#  3. Draw the texture, scaled up with nearest-neighbor.
		#  4. Draw a mask over the dots to give them a slightly more realistic look.
		
		gl.glEnable(gl.GL_BLEND)
		gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
		gl.glLoadIdentity()
		
		# Draw the dots in this color:
		gl.glColor3f(1.0, 0.5, 0.25)

		gl.glScalef(1, -1, 1)
		gl.glTranslatef(0, -DMD_SIZE[1]*DMD_SCALE, 0)

		data = frame.get_data_mult()
		image = pyglet.image.ImageData(DMD_SIZE[0], DMD_SIZE[1], 'L', data, pitch=DMD_SIZE[0])

		gl.glTexParameteri(image.get_texture().target, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST)
		image.blit(0, 0, width=DMD_SIZE[0]*DMD_SCALE, height=DMD_SIZE[1]*DMD_SCALE)

		del image

		gl.glScalef(DMD_SCALE/float(MASK_SIZE), DMD_SCALE/float(MASK_SIZE), 1.0)
		gl.glColor4f(1.0, 1.0, 1.0, 1.0)
		self.mask_texture.blit_tiled(x=0, y=0, z=0, width=DMD_SIZE[0]*MASK_SIZE, height=DMD_SIZE[1]*MASK_SIZE)
开发者ID:CarnyPriest,项目名称:CCCforVP,代码行数:28,代码来源:desktop_pyglet.py

示例8: render_boid

 def render_boid(self):
     glBegin(GL_TRIANGLES)
     glColor3f(*self.color)
     glVertex2f(-(self.size), 0.0)
     glVertex2f(self.size, 0.0)
     glVertex2f(0.0, self.size * 3.0)
     glEnd()
开发者ID:mdodsworth,项目名称:pyglet-boids,代码行数:7,代码来源:boid.py

示例9: draw_line

 def draw_line(self, v, color):
     o = self._p._origin
     pgl.glBegin(pgl.GL_LINES)
     pgl.glColor3f(*color)
     pgl.glVertex3f(v[0][0] + o[0], v[0][1] + o[1], v[0][2] + o[2])
     pgl.glVertex3f(v[1][0] + o[0], v[1][1] + o[1], v[1][2] + o[2])
     pgl.glEnd()
开发者ID:bjodah,项目名称:sympy,代码行数:7,代码来源:plot_axes.py

示例10: draw

 def draw(self):
     if draw_debug:
         glColor3f(1,1,1)
         self.vertex_list.draw(GL_LINE_LOOP)
         glColor3f(1,1,0)
         for j,r in self.forces:
             pyglet.graphics.draw(2, GL_LINES, ("v2f", (r[0], r[1], r[0] + j[0]/10, r[1] + j[1]/10)))
开发者ID:ddunwoody,项目名称:adastra,代码行数:7,代码来源:physics.py

示例11: draw_lane_lines

 def draw_lane_lines(self, lane):
     gl.glColor3f(1., 1., 1.)
     W = 1000
     graphics.draw(4, gl.GL_LINES, ('v2f',
         np.hstack([lane.p-lane.m*W-0.5*lane.w*lane.n, lane.p+lane.m*W-0.5*lane.w*lane.n,
                    lane.p-lane.m*W+0.5*lane.w*lane.n, lane.p+lane.m*W+0.5*lane.w*lane.n])
     ))
开发者ID:dsadigh,项目名称:Autonomous_Driving,代码行数:7,代码来源:visualize.py

示例12: draw

 def draw(self):
     gl.glClear(gl.GL_DEPTH_BUFFER_BIT)
     if self.game.game_over:
         if self.game.game_lost:
             gl.glBegin(gl.GL_QUADS)
             gl.glColor3f(1, 1, 1)
             gl.glVertex3f(0, 0, -0.9)
             gl.glVertex3f(0, defs.WINDOW_HEIGHT, -0.9)
             gl.glVertex3f(defs.WINDOW_WIDTH, defs.WINDOW_HEIGHT, -0.9)
             gl.glVertex3f(defs.WINDOW_WIDTH, 0, -0.9)
             gl.glEnd()
             self.you_died.draw()
             self.you_died2.draw()
             if not self.died:
                 for name in self.VALUES:
                     getattr(self, name + '_label').color = (0, 0, 0, 255)
             self.died = True
         else:
             gl.glBegin(gl.GL_QUADS)
             gl.glColor3f(0, 0, 0)
             gl.glVertex3f(0, 0, -0.9)
             gl.glVertex3f(0, defs.WINDOW_HEIGHT, -0.9)
             gl.glVertex3f(defs.WINDOW_WIDTH, defs.WINDOW_HEIGHT, -0.9)
             gl.glVertex3f(defs.WINDOW_WIDTH, 0, -0.9)
             gl.glEnd()
             self.you_win.draw()
     for name in self.VALUES:
         getattr(self, name + '_label').draw()
开发者ID:noonat,项目名称:deathbeam,代码行数:28,代码来源:score.py

示例13: draw

 def draw(self, colour=(0., 0., 1.)):
   s = self.size # just a shorthand
   gl.glColor3f(*colour)
   gl.glBegin(gl.GL_LINE_LOOP)
   for vertex in self.verticies:
     gl.glVertex2f(*vertex)
   gl.glEnd()
开发者ID:DomNomNom,项目名称:Jumpy2D,代码行数:7,代码来源:Trigger.py

示例14: f

 def f():
     for u in range(1, len(self.u_set)):
         pgl.glBegin(pgl.GL_QUAD_STRIP)
         for v in range(len(self.v_set)):
             pa = self.verts[u - 1][v]
             pb = self.verts[u][v]
             if pa is None or pb is None:
                 pgl.glEnd()
                 pgl.glBegin(pgl.GL_QUAD_STRIP)
                 continue
             if use_cverts:
                 ca = self.cverts[u - 1][v]
                 cb = self.cverts[u][v]
                 if ca is None:
                     ca = (0, 0, 0)
                 if cb is None:
                     cb = (0, 0, 0)
             else:
                 if use_solid_color:
                     ca = cb = self.default_solid_color
                 else:
                     ca = cb = self.default_wireframe_color
             pgl.glColor3f(*ca)
             pgl.glVertex3f(*pa)
             pgl.glColor3f(*cb)
             pgl.glVertex3f(*pb)
         pgl.glEnd()
开发者ID:bjodah,项目名称:sympy,代码行数:27,代码来源:plot_surface.py

示例15: draw_lane_surface

 def draw_lane_surface(self, lane):
     gl.glColor3f(0.4, 0.4, 0.4)
     W = 1000
     graphics.draw(4, gl.GL_QUAD_STRIP, ('v2f',
         np.hstack([lane.p-lane.m*W-0.5*lane.w*lane.n, lane.p-lane.m*W+0.5*lane.w*lane.n,
                    lane.q+lane.m*W-0.5*lane.w*lane.n, lane.q+lane.m*W+0.5*lane.w*lane.n])
     ))
开发者ID:dsadigh,项目名称:Autonomous_Driving,代码行数:7,代码来源:visualize.py


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