Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign/qtcompatibility #128

Merged
merged 56 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c5de932
Adds plumbing to allow integration of Qt code as optional
Jul 5, 2023
0a019be
Adds plumbing to allow integration of Qt code as optional
Jul 5, 2023
f34efc6
Merge branch 'redesign/qtcompatibility' of github.com:ABRG-Models/mor…
Jul 6, 2023
81d6788
WIP on Qt stuff.
Jul 7, 2023
5303dc9
qtmorph (external project) now compiles!
Jul 8, 2023
e3dd44d
With an QOffscreenSurface, we can now init the GL functions and compi…
Jul 9, 2023
45dedd9
Changes to ensure morphologica can be fully compiled in non-qt mode. …
Jul 9, 2023
49619df
Changes necessary to get graph1 to actually rin
Jul 9, 2023
363f61c
Qt windows are go!
Jul 9, 2023
c4b4421
Trivial reformatting. Next up: Derive a qwidget from QOpenGLWidget
Jul 9, 2023
2f43d23
WIP towards a Visual-driver QWidget
Jul 10, 2023
b34b73a
Adds plumbing to allow integration of Qt code as optional
Jul 5, 2023
c921b03
WIP on Qt stuff.
Jul 7, 2023
53827ef
qtmorph (external project) now compiles!
Jul 8, 2023
2a6df84
With an QOffscreenSurface, we can now init the GL functions and compi…
Jul 9, 2023
d8e6bbd
Changes to ensure morphologica can be fully compiled in non-qt mode. …
Jul 9, 2023
ee9affd
Changes necessary to get graph1 to actually rin
Jul 9, 2023
597f489
Qt windows are go!
Jul 9, 2023
ea5c97f
Trivial reformatting. Next up: Derive a qwidget from QOpenGLWidget
Jul 9, 2023
117f345
WIP towards a Visual-driver QWidget
Jul 10, 2023
84164b1
Merge branch 'redesign/qtcompatibility' of github.com:ABRG-Models/mor…
Jul 10, 2023
727622a
Gives Visual a mode in which it is owned by a windowing system - in t…
Jul 10, 2023
3a71cbf
Wires up some mouse events from viswidget to Visual. Reorders some of…
Jul 11, 2023
411326e
Minor stuff
Jul 11, 2023
fbe6874
Am going for the redesign of the VisualModel API, removing passing of…
Jul 11, 2023
88cb011
Changes to help all the example progs to compile
Jul 12, 2023
545a8b4
Forgot this one
Jul 12, 2023
4b59baf
Tell developer not to use poll/waitevents in 'owned' mode
Jul 12, 2023
effa296
Removes the qwindow stuff - I'll concentrate on a Visual-in-a-QWidget…
Jul 13, 2023
84b079a
Just comments
Jul 13, 2023
5ba699c
Font init bug fix (introduced with commit 2f43d23)
Jul 13, 2023
8012002
Tweaks. Wired mouse wheel up.
Jul 13, 2023
9802dfb
Accept Qt mouse/wheel events
Jul 13, 2023
023d284
Turns on anti-aliasing
Jul 15, 2023
c801e6b
Makes the key_callback handler non-GLFW specific
Jul 15, 2023
4db1653
Installation of headers (not that one 'installs' morphologica any more
Jul 15, 2023
4f5da51
Control mouse rotate mode with the Ctrl button while mousing
Jul 15, 2023
43cb500
Sorts out mouse buttons in Qt widget
Jul 15, 2023
bfb1666
Enable modifiers for mouse events
Jul 15, 2023
ac0f454
Key handling (passing key events through to morph::Visual)
Jul 15, 2023
c8a94a8
Adds missing finalize
Jul 16, 2023
18ee473
Modifies the way that postVertexInit() is called. OpenGL must be avai…
Jul 16, 2023
7d5664c
Use a callback to create VisualMOdels because OpenGL env has to have …
Jul 16, 2023
995094f
Call buildmodels if it exists
Jul 16, 2023
5b8181b
In 'owned mode' we *have* to require that setup occurs after OpenGL i…
Jul 16, 2023
d222b55
Constructor needs to change to match changes in morph::VisualModel
Jul 24, 2023
3fc9d49
Removes some unnecessary includes
Jul 24, 2023
a43d7d4
Now new VisualModels have to be added to viswidget::newvisualmodels
Aug 7, 2023
ad4805a
Adds my two early Qt examples
optseb Aug 17, 2023
697bf3d
WIP getting FPS to work
Aug 17, 2023
761a9f2
Qt example renaming
optseb Aug 17, 2023
11531d0
More example name refactoring
optseb Aug 17, 2023
77fea11
Update readme
optseb Aug 17, 2023
4b7cceb
Better description
optseb Aug 17, 2023
a7014f5
In owned mode, quitting is done by the owning windowing system
optseb Aug 17, 2023
26d027c
Makes the examples work as expected
optseb Aug 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ add_subdirectory(schnakenberg)
# A retinotectal model published by Simpson and Goodhill, 2011
add_subdirectory(SimpsonGoodhill)

# Examples showing how to use morphologica with Qt
add_subdirectory(qt)

# All #includes in test programs have to be #include <morph/header.h>
include_directories(BEFORE ${PROJECT_SOURCE_DIR})

Expand Down
11 changes: 7 additions & 4 deletions examples/Ermentrout2009/erm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ int main (int argc, char **argv)

// Set up a 3D map of the surface RD.n[0] using a morph::HexGridVisual
spatOff[0] -= 0.6 * (RD.hg->width());
auto hgv1 = std::make_unique<morph::HexGridVisual<FLT>> (v.shaders, RD.hg, spatOff);
auto hgv1 = std::make_unique<morph::HexGridVisual<FLT>> (RD.hg, spatOff);
v.bindmodel (hgv1);
hgv1->setSizeScale (myscale, myscale);
hgv1->setScalarData (&RD.n[0]);
// You can directly set VisualDataModel::zScale and ::colourScale:
Expand All @@ -176,7 +177,8 @@ int main (int argc, char **argv)

// Set up a 3D map of the surface RD.c[0]
spatOff[0] *= -1;
auto hgv2 = std::make_unique<morph::HexGridVisual<FLT>> (v.shaders, RD.hg, spatOff);
auto hgv2 = std::make_unique<morph::HexGridVisual<FLT>> (RD.hg, spatOff);
v.bindmodel (hgv2);
hgv2->setSizeScale (myscale, myscale);
hgv2->setScalarData (&RD.c[0]);
hgv2->zScale.setParams (_m/10.0f, _c/10.0f);
Expand All @@ -190,7 +192,8 @@ int main (int argc, char **argv)

// Set up a 2D graph with morph::GraphVisual
spatOff = {0.5f, -2.0f, 0.0f};
auto graph1 = std::make_unique<morph::GraphVisual<FLT>> (v.shaders, spatOff);
auto graph1 = std::make_unique<morph::GraphVisual<FLT>> (spatOff);
v.bindmodel (graph1);
graph1->setdarkbg(); // colours axes and text
graph1->twodimensional = true;
graph1->setlimits (0, steps*RD.get_dt(), 0, conf.getFloat("graph_ymax", 40000.0f));
Expand Down Expand Up @@ -248,7 +251,7 @@ int main (int argc, char **argv)
// rendering the graphics.
std::chrono::steady_clock::duration sincerender = std::chrono::steady_clock::now() - lastrender;
if (std::chrono::duration_cast<std::chrono::milliseconds>(sincerender).count() > 17) { // 17 is about 60 Hz
glfwPollEvents();
v.poll();
v.render();
lastrender = std::chrono::steady_clock::now();
}
Expand Down
8 changes: 5 additions & 3 deletions examples/LotkaVolterra/lv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ int main (int argc, char **argv)
// A. Offset in x direction to the left.
xzero -= 0.5*RD.hg->width();
spatOff = { xzero, 0.0, 0.0 };
auto uvm = std::make_unique<morph::HexGridVisual<FLT>> (v1.shaders, RD.hg, spatOff);
auto uvm = std::make_unique<morph::HexGridVisual<FLT>> (RD.hg, spatOff);
v1.bindmodel (uvm);
uvm->setScalarData (&(RD.u));
uvm->zScale.setParams (0.2f, 0.0f);
uvm->addLabel ("Population u", { -0.2f, RD.ellipse_b*-1.4f, 0.01f },
Expand All @@ -263,7 +264,8 @@ int main (int argc, char **argv)
// B. Offset in x direction to the right.
xzero += RD.hg->width();
spatOff = { xzero, 0.0, 0.0 };
auto vvm = std::make_unique<morph::HexGridVisual<FLT>> (v1.shaders, RD.hg, spatOff);
auto vvm = std::make_unique<morph::HexGridVisual<FLT>> (RD.hg, spatOff);
v1.bindmodel (vvm);
vvm->setScalarData (&(RD.v));
vvm->zScale.setParams (0.2f, 0.0f);
vvm->addLabel ("Population v", { -0.2f, RD.ellipse_b*-1.4f, 0.01f },
Expand Down Expand Up @@ -302,7 +304,7 @@ int main (int argc, char **argv)
// has elapsed for it to be necessary to call v1.render().
steady_clock::duration sincerender = steady_clock::now() - lastrender;
if (duration_cast<milliseconds>(sincerender).count() > 17) { // 17 is about 60 Hz
glfwPollEvents();
v1.poll();
v1.render();
lastrender = steady_clock::now();
}
Expand Down
10 changes: 3 additions & 7 deletions examples/SimpsonGoodhill/branchvisual.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ template <typename Flt>
class BranchVisual : public morph::VisualModel
{
public:
BranchVisual(morph::gl::shaderprogs& sp,
const morph::vec<float, 3> _offset,
std::vector<branch<Flt>>* _branches)
BranchVisual(const morph::vec<float, 3> _offset, std::vector<branch<Flt>>* _branches)
{
this->branches = _branches;
this->shaders = sp;
this->mv_offset = _offset;
this->viewmatrix.translate (this->mv_offset);
}
Expand All @@ -43,7 +40,6 @@ class BranchVisual : public morph::VisualModel

void initializeVertices()
{
VBOint idx = 0;
// For each branch, draw lines for the path history and a sphere for teh current
// location, with a second colour for the EphA expression.
for (auto b : *this->branches) {
Expand All @@ -58,11 +54,11 @@ class BranchVisual : public morph::VisualModel
last[1] = b.path[i-1][1];
cur[0] = b.path[i][0];
cur[1] = b.path[i][1];
this->computeFlatLineRnd (idx, last, cur, this->uz, clr, this->linewidth, 0.0f, true, false);
this->computeFlatLineRnd (this->idx, last, cur, this->uz, clr, this->linewidth, 0.0f, true, false);
}
// Finally, a sphere at the last location. Tune number of rings (second last
// arg) in sphere to change size of clr2 disc at top
this->computeSphere (idx, cur, clr, clr2, this->radiusFixed, 14, 12);
this->computeSphere (this->idx, cur, clr, clr2, this->radiusFixed, 14, 12);
}
}

Expand Down
8 changes: 3 additions & 5 deletions examples/SimpsonGoodhill/netvisual.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,26 @@ template <typename Flt>
class NetVisual : public morph::VisualModel
{
public:
NetVisual(morph::gl::shaderprogs& sp, const morph::vec<float, 3> _offset, net<Flt>* _locations)
NetVisual(const morph::vec<float, 3> _offset, net<Flt>* _locations)
{
this->locations = _locations;
this->shaders = sp;
this->mv_offset = _offset;
this->viewmatrix.translate (this->mv_offset);
}

void initializeVertices()
{
VBOint idx = 0;
// Spheres at the net vertices
for (unsigned int i = 0; i < this->locations->p.size(); ++i) {
this->computeSphere (idx, this->locations->p[i], this->locations->clr[i], this->radiusFixed, 14, 12);
this->computeSphere (this->idx, this->locations->p[i], this->locations->clr[i], this->radiusFixed, 14, 12);
}
// Connections
for (auto c : this->locations->c) {
morph::vec<Flt, 3> c1 = this->locations->p[c[0]];
morph::vec<Flt, 3> c2 = this->locations->p[c[1]];
std::array<float, 3> clr1 = this->locations->clr[c[0]];
std::array<float, 3> clr2 = this->locations->clr[c[1]];
this->computeLine (idx, c1, c2, this->uz, clr1, clr2, this->linewidth, this->linewidth/Flt{4});
this->computeLine (this->idx, c1, c2, this->uz, clr1, clr2, this->linewidth, this->linewidth/Flt{4});
}
}

Expand Down
13 changes: 8 additions & 5 deletions examples/SimpsonGoodhill/sg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ struct SimpsonGoodhill
void vis(unsigned int stepnum)
{
if (this->goslow == true) {
glfwWaitEventsTimeout (0.1); // to add artificial slowing
v->waitevents (0.1); // to add artificial slowing
} else {
glfwPollEvents();
v->poll();
}
this->bv->reinit();
this->cv->reinit();
Expand Down Expand Up @@ -149,22 +149,25 @@ struct SimpsonGoodhill
morph::vec<float> offset = { -1.5f, -0.5f, 0.0f };

// Visualise the branches with a custom VisualModel
auto bvup = std::make_unique<BranchVisual<T>> (v->shaders, offset, &this->branches);
auto bvup = std::make_unique<BranchVisual<T>> (offset, &this->branches);
v->bindmodel (bvup);
bvup->EphA_scale.compute_autoscale (EphA_min, EphA_max);
bvup->addLabel ("Branches", {0.0f, 1.1f, 0.0f});
bvup->finalize();
this->bv = v->addVisualModel (bvup);

// Centroids of branches viewed with a NetVisual
offset[0] += 1.3f;
auto cvup = std::make_unique<NetVisual<T>> (v->shaders, offset, &this->ax_centroids);
auto cvup = std::make_unique<NetVisual<T>> (offset, &this->ax_centroids);
v->bindmodel (cvup);
cvup->addLabel ("Axon centroids", {0.0f, 1.1f, 0.0f});
cvup->finalize();
this->cv = v->addVisualModel (cvup);

// Show a vis of the retina, to compare positions/colours
offset[0] += 1.3f;
auto cgv = std::make_unique<morph::CartGridVisual<float>>(v->shaders, retina, offset);
auto cgv = std::make_unique<morph::CartGridVisual<float>>(retina, offset);
v->bindmodel (cgv);
cgv->cartVisMode = morph::CartVisMode::RectInterp;
std::vector<morph::vec<float, 3>> points = this->retina->getCoordinates3();
cgv->setVectorData (&points);
Expand Down
28 changes: 19 additions & 9 deletions examples/anneal_asa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ int main (int argc, char** argv)
v.lightingEffects (true);

morph::vec<float, 3> offset = { 0.0, 0.0, 0.0 };
auto hgv = std::make_unique<morph::HexGridVisual<F>>(v.shaders, hg, offset);
auto hgv = std::make_unique<morph::HexGridVisual<F>>(hg, offset);
v.bindmodel (hgv);
hgv->setScalarData (&obj_f);
#ifdef USE_BOHACHEVSKY_FUNCTION
hgv->addLabel ("Objective: See Bohachevsky et al.", { -0.5f, -0.75f, -0.1f }, morph::colour::black);
Expand All @@ -110,20 +111,27 @@ int main (int argc, char** argv)

// One object for the 'candidate' position
std::array<float, 3> col = { 0, 1, 0 };
auto cand_up = std::make_unique<morph::PolygonVisual>(v.shaders, offset, polypos, morph::vec<float>({1,0,0}), 0.005f, 0.4f, col, 20);

auto cand_up = std::make_unique<morph::PolygonVisual>(offset, polypos, morph::vec<float>({1,0,0}), 0.005f, 0.4f, col, 20);
v.bindmodel (cand_up);
cand_up->finalize();
// A second object for the 'best' position
col = { 1, 0, 0 };
auto best_up = std::make_unique<morph::PolygonVisual>(v.shaders, offset, polypos, morph::vec<float>({1,0,0}), 0.001f, 0.8f, col, 10);
auto best_up = std::make_unique<morph::PolygonVisual>(offset, polypos, morph::vec<float>({1,0,0}), 0.001f, 0.8f, col, 10);
v.bindmodel (best_up);
best_up->finalize();

// A third object for the currently accepted position
col = { 1, 0, 0.7f };
auto curr_up = std::make_unique<morph::PolygonVisual> (v.shaders, offset, polypos, morph::vec<float>({1,0,0}), 0.005f, 0.6f, col, 20);
auto curr_up = std::make_unique<morph::PolygonVisual> (offset, polypos, morph::vec<float>({1,0,0}), 0.005f, 0.6f, col, 20);
v.bindmodel (curr_up);
curr_up->finalize();

// Fourth object marks the starting place
col = { .5f, .5f, .5f };
polypos[2] = objective(p);
auto sp = std::make_unique<morph::PolygonVisual> (v.shaders, offset, polypos, morph::vec<float>({1,0,0}), 0.005f, 0.6f, col, 20);
auto sp = std::make_unique<morph::PolygonVisual> (offset, polypos, morph::vec<float>({1,0,0}), 0.005f, 0.6f, col, 20);
v.bindmodel (sp);
sp->finalize();

auto candp = v.addVisualModel (cand_up);
auto bestp = v.addVisualModel (best_up);
Expand All @@ -132,7 +140,8 @@ int main (int argc, char** argv)

// Add a graph to track T_i and T_cost
morph::vec<float> spatOff = {1.2f, -0.5f, 0.0f};
auto graph1 = std::make_unique<morph::GraphVisual<F>> (v.shaders, spatOff);
auto graph1 = std::make_unique<morph::GraphVisual<F>> (spatOff);
v.bindmodel (graph1);
graph1->twodimensional = true;
graph1->setlimits (0, 1000, -10, 1);
graph1->policy = morph::stylepolicy::lines;
Expand All @@ -144,7 +153,8 @@ int main (int argc, char** argv)
auto graph1p = v.addVisualModel (graph1);

spatOff[0] += 1.1f;
auto graph2 = std::make_unique<morph::GraphVisual<F>> (v.shaders, spatOff);
auto graph2 = std::make_unique<morph::GraphVisual<F>> (spatOff);
v.bindmodel (graph2);
graph2->twodimensional = true;
graph2->setlimits (0, 1000, -1.0f, 1.0f);
graph2->policy = morph::stylepolicy::lines;
Expand Down Expand Up @@ -201,7 +211,7 @@ int main (int argc, char** argv)
graph2p->append ((float)anneal.steps, anneal.f_x_cand+0.2, 2);


glfwWaitEventsTimeout (0.0166);
v.waitevents (0.0166);
v.render();
#endif
// Finally, you need to ask the algorithm to do its stuff for one step
Expand Down
5 changes: 3 additions & 2 deletions examples/cartgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,16 @@ int main()

// Add a CartGridVisual to display the CartGrid within the morph::Visual scene
morph::vec<float, 3> offset = { 0.0f, -0.05f, 0.0f };
auto cgv = std::make_unique<morph::CartGridVisual<float>>(v.shaders, &cg, offset);
auto cgv = std::make_unique<morph::CartGridVisual<float>>(&cg, offset);
v.bindmodel (cgv);
cgv->cartVisMode = morph::CartVisMode::RectInterp;
cgv->setScalarData (&data);
cgv->cm.setType (morph::ColourMapType::Twilight);
cgv->finalize();
v.addVisualModel (cgv);

while (v.readyToFinish == false) {
glfwWaitEventsTimeout (0.018);
v.waitevents (0.018);
v.render();
}

Expand Down
12 changes: 8 additions & 4 deletions examples/convolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ int main()

// Visualize the 3 maps
morph::vec<float, 3> offset = { -0.5, 0.0, 0.0 };
auto hgv = std::make_unique<morph::HexGridVisual<float>>(v.shaders, &hg, offset);
auto hgv = std::make_unique<morph::HexGridVisual<float>>(&hg, offset);
v.bindmodel (hgv);
hgv->setScalarData (&data);
hgv->cm.setType(morph::ColourMapType::Viridis);
hgv->addLabel ("Input", { -0.3f, -0.45f, 0.01f }, morph::colour::white);
Expand All @@ -81,7 +82,8 @@ int main()
auto hgvp = v.addVisualModel (hgv);

offset[1] += 0.6f;
auto kgv = std::make_unique<morph::HexGridVisual<float>>(v.shaders, &kernel, offset);
auto kgv = std::make_unique<morph::HexGridVisual<float>>(&kernel, offset);
v.bindmodel (kgv);
kgv->setScalarData (&kerneldata);
kgv->cm.setType(morph::ColourMapType::Viridis);
kgv->finalize();
Expand All @@ -92,11 +94,13 @@ int main()

offset[1] -= 0.6f;
offset[0] += 1.0f;
auto rgv = std::make_unique<morph::HexGridVisual<float>>(v.shaders, &hg, offset);
auto rgv = std::make_unique<morph::HexGridVisual<float>>(&hg, offset);
v.bindmodel (rgv);
rgv->setScalarData (&convolved);
rgv->cm.setType(morph::ColourMapType::Viridis);
rgv->finalize();
rgv->addLabel ("Output", { -0.3f, -0.45f, 0.01f }, morph::colour::white);
rgv->finalize();
auto rgvp = v.addVisualModel (rgv);

// Demonstrate how to divide existing scale by 10:
Expand All @@ -108,7 +112,7 @@ int main()
rgvp->updateZScale (zscale);

while (v.readyToFinish == false) {
glfwWaitEventsTimeout (0.018);
v.waitevents (0.018);
v.render();
}

Expand Down
9 changes: 6 additions & 3 deletions examples/convolve_rect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ int main()
morph::Visual v(800,600,"Convolution window");

morph::vec<float, 3> offset = { 0.0f, 0.0f, 0.0f };
auto cgv = std::make_unique<morph::CartGridVisual<float>>(v.shaders, &cg, offset);
auto cgv = std::make_unique<morph::CartGridVisual<float>>(&cg, offset);
v.bindmodel (cgv);
cgv->cartVisMode = morph::CartVisMode::RectInterp;
cgv->setScalarData (&data);
cgv->cm.setType (morph::ColourMapType::GreyscaleInv);
Expand All @@ -80,7 +81,8 @@ int main()
v.addVisualModel (cgv);

offset = { 0.0f, -0.3f, 0.0f };
auto cgvk = std::make_unique<morph::CartGridVisual<float>>(v.shaders, &kernel, offset);
auto cgvk = std::make_unique<morph::CartGridVisual<float>>(&kernel, offset);
v.bindmodel (cgvk);
cgvk->cartVisMode = morph::CartVisMode::RectInterp;
cgvk->setScalarData (&kdata);
cgvk->cm.setType (morph::ColourMapType::GreyscaleInv);
Expand All @@ -91,7 +93,8 @@ int main()
v.addVisualModel (cgvk);

offset = { 0.0f, -1.3f, 0.0f };
auto cgvr = std::make_unique<morph::CartGridVisual<float>>(v.shaders, &cg, offset);
auto cgvr = std::make_unique<morph::CartGridVisual<float>>(&cg, offset);
v.bindmodel (cgvr);
cgvr->cartVisMode = morph::CartVisMode::RectInterp;
cgvr->setScalarData (&convolved);
cgvr->cm.setType (morph::ColourMapType::GreyscaleInv);
Expand Down
5 changes: 3 additions & 2 deletions examples/duochrome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ int main (int argc, char** argv)
}
}

auto sv = std::make_unique<morph::ScatterVisual<float>> (v.shaders, offset);
auto sv = std::make_unique<morph::ScatterVisual<float>> (offset);
v.bindmodel (sv);
sv->setDataCoords (&points);
sv->setScalarData (&data);
// Set the vector data to the coordinates - we'll visualize duochrome based on x and y
Expand All @@ -58,7 +59,7 @@ int main (int argc, char** argv)

v.render();
while (v.readyToFinish == false) {
glfwWaitEventsTimeout (0.018);
v.waitevents (0.018);
v.render();
}

Expand Down
5 changes: 3 additions & 2 deletions examples/fps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ int main()

// Add a HexGridVisual to display the HexGrid within the morph::Visual scene
morph::vec<float, 3> offset = { 0.0, -0.05, 0.0 };
auto hgv = std::make_unique<morph::HexGridVisual<float>>(v.shaders, &hg, offset);
auto hgv = std::make_unique<morph::HexGridVisual<float>>(&hg, offset);
v.bindmodel (hgv);
hgv->setScalarData (&data);
hgv->hexVisMode = morph::HexVisMode::Triangles;
hgv->finalize();
Expand All @@ -57,7 +58,7 @@ int main()
auto tstart = steady_clock::now();
unsigned int fcount = 0;
while (v.readyToFinish == false) {
glfwWaitEventsTimeout (0.00001);
v.waitevents (0.00001);
if (k > 8.0f) { k = 1.0f; }

#pragma omp parallel for shared(r,k,data)
Expand Down
Loading