MCPcopy Create free account
hub / github.com/boostorg/compute / NBodyWidget

Class NBodyWidget

example/nbody.cpp:74–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72);
73
74class NBodyWidget : public QGLWidget
75{
76 Q_OBJECT
77
78public:
79 NBodyWidget(std::size_t particles, float dt, QWidget* parent = 0);
80 ~NBodyWidget();
81
82 void initializeGL();
83 void resizeGL(int width, int height);
84 void paintGL();
85 void updateParticles();
86 void keyPressEvent(QKeyEvent* event);
87
88private:
89 QTimer* timer;
90
91 compute::context m_context;
92 compute::command_queue m_queue;
93 compute::program m_program;
94 compute::opengl_buffer m_position;
95 compute::vector<float4_>* m_velocity;
96 compute::kernel m_velocity_kernel;
97 compute::kernel m_position_kernel;
98
99 bool m_initial_draw;
100
101 const uint_ m_particles;
102 const float m_dt;
103};
104
105NBodyWidget::NBodyWidget(std::size_t particles, float dt, QWidget* parent)
106 : QGLWidget(parent), m_initial_draw(true), m_particles(particles), m_dt(dt)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected