|
|
|
@ -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; |
|
|
|
|