本文整理汇总了Python中pyglet.gl.glEnd方法的典型用法代码示例。如果您正苦于以下问题:Python gl.glEnd方法的具体用法?Python gl.glEnd怎么用?Python gl.glEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyglet.gl
的用法示例。
在下文中一共展示了gl.glEnd方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render_road
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glEnd [as 别名]
def render_road(self):
gl.glBegin(gl.GL_QUADS)
gl.glColor4f(0.4, 0.8, 0.4, 1.0)
gl.glVertex3f(-PLAYFIELD, +PLAYFIELD, 0)
gl.glVertex3f(+PLAYFIELD, +PLAYFIELD, 0)
gl.glVertex3f(+PLAYFIELD, -PLAYFIELD, 0)
gl.glVertex3f(-PLAYFIELD, -PLAYFIELD, 0)
gl.glColor4f(0.4, 0.9, 0.4, 1.0)
k = PLAYFIELD/20.0
for x in range(-20, 20, 2):
for y in range(-20, 20, 2):
gl.glVertex3f(k*x + k, k*y + 0, 0)
gl.glVertex3f(k*x + 0, k*y + 0, 0)
gl.glVertex3f(k*x + 0, k*y + k, 0)
gl.glVertex3f(k*x + k, k*y + k, 0)
for poly, color in self.road_poly:
gl.glColor4f(color[0], color[1], color[2], 1)
for p in poly:
gl.glVertex3f(p[0], p[1], 0)
gl.glEnd()
示例2: draw_triangle_left
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glEnd [as 别名]
def draw_triangle_left(self):
if self.show_triangle_left:
w = 200
h = 200
x = self.window.width // 4 - w // 2
y = (self.window.height - h) // 2
gl.glEnable(gl.GL_DEPTH_TEST)
gl.glBegin(gl.GL_TRIANGLES)
gl.glColor4f(1, 0, 0, 1)
gl.glVertex3f(x, y, -1)
gl.glColor4f(0, 1, 0, 1)
gl.glVertex3f(x+w, y, 0)
gl.glColor4f(0, 0, 1, 1)
gl.glVertex3f(x, y+h, 1)
gl.glEnd()
gl.glDisable(gl.GL_DEPTH_TEST)
gl.glColor4f(1, 1, 1, 1)
示例3: render_indicators
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glEnd [as 别名]
def render_indicators(self, W, H):
gl.glBegin(gl.GL_QUADS)
s = W/40.0
h = H/40.0
gl.glColor4f(0,0,0,1)
gl.glVertex3f(W, 0, 0)
gl.glVertex3f(W, 5*h, 0)
gl.glVertex3f(0, 5*h, 0)
gl.glVertex3f(0, 0, 0)
def vertical_ind(place, val, color):
gl.glColor4f(color[0], color[1], color[2], 1)
gl.glVertex3f((place+0)*s, h + h*val, 0)
gl.glVertex3f((place+1)*s, h + h*val, 0)
gl.glVertex3f((place+1)*s, h, 0)
gl.glVertex3f((place+0)*s, h, 0)
def horiz_ind(place, val, color):
gl.glColor4f(color[0], color[1], color[2], 1)
gl.glVertex3f((place+0)*s, 4*h , 0)
gl.glVertex3f((place+val)*s, 4*h, 0)
gl.glVertex3f((place+val)*s, 2*h, 0)
gl.glVertex3f((place+0)*s, 2*h, 0)
true_speed = np.sqrt(np.square(self.car.hull.linearVelocity[0]) + np.square(self.car.hull.linearVelocity[1]))
vertical_ind(5, 0.02*true_speed, (1,1,1))
vertical_ind(7, 0.01*self.car.wheels[0].omega, (0.0,0,1)) # ABS sensors
vertical_ind(8, 0.01*self.car.wheels[1].omega, (0.0,0,1))
vertical_ind(9, 0.01*self.car.wheels[2].omega, (0.2,0,1))
vertical_ind(10,0.01*self.car.wheels[3].omega, (0.2,0,1))
horiz_ind(20, -10.0*self.car.wheels[0].joint.angle, (0,1,0))
horiz_ind(30, -0.8*self.car.hull.angularVelocity, (1,0,0))
gl.glEnd()
self.score_label.text = "%04i" % self.reward
self.score_label.draw()
示例4: draw
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glEnd [as 别名]
def draw(self):
gl.glColor3f(1, 1, 1)
gl.glBegin(gl.GL_LINES)
gl.glVertex2f(0, 50)
gl.glVertex2f(self.window.width, 50)
gl.glEnd()
for label in self.labels:
label.draw()