Compare commits

..

No commits in common. 'e2bf29bf757fd1915f1a53dd2a38c2b5d4d456ef' and '24895e5cd4037d39cc037b12f36279b31477f90a' have entirely different histories.

  1. 2
      src/GLWidget.cpp
  2. 1
      src/MainWindow.cpp
  3. 33
      src/Simulation.cpp
  4. 4
      src/Simulation.h

@ -103,7 +103,7 @@ bool GLWidget::AnyDialogOpen() {
void GLWidget::uploadStaticDataToGPU() {
auto pendula = &simulation->pendula;
size_t pointCount = std::transform_reduce(pendula->begin(), pendula->end(), 0, [](size_t prev, size_t curr){
int pointCount = std::transform_reduce(pendula->begin(), pendula->end(), 0, [](int prev, int curr){
return prev + curr + 1;
}, [](const Pendulum * p){
return p->X.size();

@ -23,7 +23,6 @@ MainWindow::MainWindow() {
simulation = new Simulation;
simulation->moveToThread(simulationThread);
simulationThread->start();
QMetaObject::invokeMethod(simulation, &Simulation::initialize);
masses = std::vector<double>(MaxSegments);
lengths = std::vector<double>(MaxSegments);

@ -5,9 +5,6 @@
#include <omp.h>
#include <iostream>
#include "FPS.h"
#include <QOpenGLContext>
#include <QOpenGLShaderProgram>
#include <QOffscreenSurface>
Simulation::Simulation() {
ups = new FPS;
@ -19,36 +16,6 @@ Simulation::Simulation() {
timer->start();
};
void Simulation::initialize() {
// OpenGL Offscreen functions
{
auto context = new QOpenGLContext(this);
context->setFormat(QSurfaceFormat::defaultFormat());
context->create();
auto surface = new QOffscreenSurface(nullptr, this);
surface->setFormat(context->format());
surface->create();
context->makeCurrent(surface);
initializeOpenGLFunctions();
}
int maxWorkGroupCount[3];
int maxWorkGroupSize[3];
int maxWorkGroupInvocations;
for (int i = 0; i < 3; i++){
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, i, maxWorkGroupCount + i);
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, i, maxWorkGroupSize + i);
}
glGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, &maxWorkGroupInvocations);
printf("Max work group count: (%d, %d, %d)\n", maxWorkGroupCount[0], maxWorkGroupCount[1], maxWorkGroupCount[2]);
printf("Max work group size: (%d, %d, %d)\n", maxWorkGroupSize[0], maxWorkGroupSize[1], maxWorkGroupSize[2]);
printf("Max work group invocations (x * y * z): %d\n", maxWorkGroupInvocations);
}
void Simulation::update() {
if (!isPlaying)
return;

@ -4,12 +4,11 @@
#include <chrono>
#include "Pendulum.h"
#include <semaphore>
#include <QOpenGLFunctions_4_3_Core>
class QTimer;
class FPS;
class Simulation : public QObject, protected QOpenGLFunctions_4_3_Core {
class Simulation : public QObject {
Q_OBJECT
public:
explicit Simulation();
@ -29,7 +28,6 @@ public:
std::binary_semaphore semaphore = std::binary_semaphore(1);
FPS * ups;
void initialize();
void updateEnergy();
signals:
void layoutChanged();

Loading…
Cancel
Save