tbattz / openglplotlive Goto Github PK
View Code? Open in Web Editor NEWA simple openGL 2D plotter for quickly updated data.
License: GNU General Public License v3.0
A simple openGL 2D plotter for quickly updated data.
License: GNU General Public License v3.0
openGLPlotLive/src/lines/Line2D2Vecs.cpp
Line 21 in 26ef414
/* Setup Buffers */
updateInternalData();
int vertDataSizeBytes = internalData.size()*sizeof(internalData[0]);
int indicesDataSizeBytes = internalIndices.size()*sizeof(internalIndices[0]);
createAndSetupBuffers(vertDataSizeBytes, indicesDataSizeBytes,
&internalData[0], &internalIndices[0],
2*sizeof(internalData[0]));
although it compiles and runs OK under windows using GCC compiler, the code above fails in MSVC 2019 compiled executable 'movingTimeframe.exe'
I guess it should be preallocated to contain certain size? I don't know why it runs OK when compiled with g++ toolchain under windows.
The procedure to completely build using MSVC is tedious including :
But without doubt, this is a terrific example of OpenGL that I'm learning from. Thank you!
openGLPlotLive/src/lines/Line2D2Vecs.cpp
Line 21 in 26ef414
/* Setup Buffers */
updateInternalData();
int vertDataSizeBytes = (1+internalData.size())*sizeof(internalData[0]);
int indicesDataSizeBytes = (1+internalIndices.size())*sizeof(internalIndices[0]);
createAndSetupBuffers(vertDataSizeBytes, indicesDataSizeBytes,
&internalData[0], &internalIndices[0],
2*sizeof(internalData[0]));
although it compiles and runs OK under windows using GCC compiler, the code above fails in MSVC 2019 compiled executable 'movingTimeframe.exe'
I guess it should be preallocated to contain certain size? I don't know why it runs OK when compiled with g++ toolchain under windows.
The procedure to completely build using MSVC is tedious including :
But without doubt, this is a terrific example of OpenGL that I'm learning from. Thank you!
Hi,
First of all, I love this project!
My case is to run a soft real-time plot only over the most recent data (let us say 1000 time instances) and the previous portion should be dismissed. That is, the x-axis's origin tick number needs to increase once more than 1000 data points are received, yet keeping the x-axis span at 1000 time instances.
I tested the "examplePLot"(Spring Damping Live Plot) and found that the x-axis's origin is fixed at zero as more data are received.
Any ideas?
Thanks
class AxesArea
{
std::vector interactorDataX = {};
std::vector interactorDataY = {};
std::vector zoomBoxX = {};
std::vector zoomBoxY = {};
}
// Create Plot
myplot = std::make_sharedGLPL::Plot(0.0, 0.0, 1.0, 1.0, getParentDimensions(), 2, 2);
std::shared_ptrGLPL::IDrawable myPlotPt = std::dynamic_pointer_castGLPL::IDrawable(myplot);
addPlot(myPlotPt);
Crash
interactorLine = std::make_shared(&interactorDataX, &interactorDataY, newParentPointers);
Line2D2Vecs::Line2D2Vecs()
{
createAndSetupBuffers(vertDataSizeBytes, indicesDataSizeBytes, &internalData[0], &internalIndices[0],
}
because internalData[0] empty, how it works?
Hi,
I would like to know if it is possibile to update dynamically a graph containing scatter plots.
For example, by using lines, this code works:
// Init GLFW
std::shared_ptr<GLPL::IWindow> window = std::shared_ptr<GLPL::IWindow>(new GLPL::Window(windowWidth, windowHeight, false, false));
std::shared_ptr<GLPL::Window> window2 = std::dynamic_pointer_cast<GLPL::Window>(window);
std::shared_ptr<GLPL::Plot> myplot = std::make_shared<GLPL::Plot>(0.0, 0.0, 1.0, 1.0, window2->getParentDimensions(), 2, 2);
std::shared_ptr<GLPL::IDrawable> myPlotPt = std::dynamic_pointer_cast<GLPL::IDrawable>(myplot);
window2->addPlot(myPlotPt);
std::shared_ptr<GLPL::Axes2D> axesPt = std::dynamic_pointer_cast<GLPL::Axes2D>(myplot->getAxes(0));
std::shared_ptr<GLPL::ILine2D> line9s = axesPt->addLine(&xVec57, &yVec57, GLPL::SINGLE_LINE, LC_MAGENTA, 1.9, "Theor Flow");
std::shared_ptr<GLPL::Line2D2Vecs> line9sd = std::dynamic_pointer_cast<GLPL::Line2D2Vecs>(line9s);
/*float i = 0;*/
while(!glfwWindowShouldClose(window->getWindow())) {
window2->preLoopDraw(true);
line9sd->dataPtX->clear();
line9sd->dataPtY->clear();
line9sd->dataPtX->push_back(modeN);
line9sd->dataPtY->push_back(0);
line9sd->dataPtX->push_back(modeN);
line9sd->dataPtY->push_back(matInput[modeN][2]);
....
line9sd->updateInternalData();
// Draw Plot
myplot->Draw();
// Post-loop draw
window2->postLoopDraw();
}
First question: is this the way of proceeding correct, in order to update the vector at each step in the loop?
Second question: for scatter plot, a method 'updateInternalData' does not exist. I there way
to update a scatter plot dynamically?
Thank you
Walter
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.