MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / render

Function render

pyPBD/examples/pendulum.py:39–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38# render pendulum
39def render():
40 sim = pbd.Simulation.getCurrent()
41 model = sim.getModel()
42
43 # render distance constraints
44 pd = model.getParticles()
45 glLineWidth(2.0)
46 glColor3f(1.0, 1.0, 1.0)
47 glBegin(GL_LINE_STRIP)
48 for i in range(numParticles):
49 glVertex3fv(pd.getPosition(i))
50 glEnd()
51
52 # render particles
53 glPointSize(8.0)
54 glColor3f(0.1, 0.7, 0.3)
55 glBegin(GL_POINTS)
56 for i in range(numParticles):
57 glVertex3fv(pd.getPosition(i))
58 glEnd()
59
60 # render time
61 glPushMatrix()
62 glLoadIdentity()
63 drawText([-0.95,0.9], "Time: {:.2f}".format(pbd.TimeManager.getCurrent().getTime()))
64 glPopMatrix()
65
66# Perform simulation steps
67def timeStep():

Callers 1

mainFunction · 0.70

Calls 5

drawTextFunction · 0.85
getModelMethod · 0.80
getTimeMethod · 0.80
getCurrentMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected