def test_anti_alias_off(self): from grease.renderer import Vector world = self.make_world() renderer = Vector(anti_alias=False) renderer.set_world(world) gl = TestGL() renderer.draw(gl=gl) self.assertTrue(gl.GL_LINE_SMOOTH not in gl.enabled) self.assertTrue(gl.GL_BLEND not in gl.enabled)
def test_draw_empty(self): from grease.renderer import Vector world = TestWorld() world.shapes = [] world.positions = [] world.renderable = [] renderer = Vector() renderer.set_world(world) gl = TestGL() # Renderer should run without complaint with no verts renderer.draw(gl=gl)
def test_draw_plain(self): from grease.renderer import Vector from grease.geometry import Vec2d, Vec2dArray import pyglet world = self.make_world() renderer = Vector() renderer.set_world(world) gl = TestGL() renderer.draw(gl=gl) self.assertTrue(gl.GL_VERTEX_ARRAY in gl.enabled) self.assertTrue(gl.GL_COLOR_ARRAY in gl.enabled) self.assertEqual(gl.client_attrib_pushed, gl.GL_CLIENT_VERTEX_ARRAY_BIT) verts = gl.vert_pointer.contents indices = gl.draw_indices.contents self.assertTrue(len(verts) > max(indices)) self.assertTrue(len(indices) >= gl.draw_count) self.assertTrue(gl.draw_count < 65536) self.assertEqual(gl.draw_type, pyglet.gl.GL_UNSIGNED_SHORT) self.assertTrue(gl.state_reset) self.assertFalse(hasattr(gl, 'line_width'))