| 170 | glViewport(0, 0, width, height); |
| 171 | } |
| 172 | void NBodyWidget::paintGL() |
| 173 | { |
| 174 | // clear buffer |
| 175 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| 176 | |
| 177 | // check if this is the first draw |
| 178 | if(m_initial_draw) { |
| 179 | // do not update particles |
| 180 | m_initial_draw = false; |
| 181 | } else { |
| 182 | // update particles |
| 183 | updateParticles(); |
| 184 | } |
| 185 | |
| 186 | // draw |
| 187 | glVertexPointer(4, GL_FLOAT, 0, 0); |
| 188 | glEnableClientState(GL_VERTEX_ARRAY); |
| 189 | glDrawArrays(GL_POINTS, 0, m_particles); |
| 190 | glFinish(); |
| 191 | } |
| 192 | void NBodyWidget::updateParticles() |
| 193 | { |
| 194 | // enqueue kernels to update particles and make sure that the command queue is finished |
nothing calls this directly
no outgoing calls
no test coverage detected