PDA

View Full Version : learning from OpenGL for physical simulation



dicktim
03-18-2017, 08:02 AM
Dear all, i have a big problem in visualization for my simulation , which is related to physics. I don't know where can i start learning from the OpenGL,
Actually, i just want to visualize the 2D-array and 3D-array and my array only content -1 or 1 , two numbers

Indeed, i just want to show the colors in OpenGL, but i don't know which tutorial show i learn....:(:(:(:(

For example ,if the array is {1,-1,1,-1} let Black for 1 and white for -1
i want the openGL can show 4 squares , just like the chess
and 2 black 2 white and also want to show the array dynamically, what i mean is that.. the number in the array will change rapidly, from -1 --> 1 , or 1 --> -1
such that the graph can change too,

Anyone can help me or provide some suggestion.. please need help

BBeck1
03-18-2017, 08:45 AM
I am doubting that OpenGL is the best tool for this job, and I say that as a huge fan of OpenGL. If you want to learn OGL, I would recommend LearnOpenGL.com (https://learnopengl.com/) as a place to start.

But to merely visualize math problems you may be re-inventing the wheel and going about it in one of the most difficult ways possible.

I know when I was in college, many years ago, they were using programs like Mathematica (https://www.wolfram.com/mathematica/pricing/home-hobby-individuals.php) to visualize math problems.

Dark Photon
03-19-2017, 04:44 PM
i have a big problem in visualization for my simulation , which is related to physics. I don't know where can i start learning from the OpenGL,
Actually, i just want to visualize the 2D-array and 3D-array and my array only content -1 or 1 , two numbers

Indeed, i just want to show the colors in OpenGL

While you could do this, as BBeck1 says you may want to check out existing packages which already implement the visualization techniques you want to use on your 2D slice and 3D data.

Do you have a sense for what kinds of visualizations you're interested in?

Just to get you started, you might want to take a look at some examples for an existing visualization library and toolset, VTK:

* https://www.bu.edu/tech/support/research/training-consulting/online-tutorials/vtk/
* http://www.vtk.org/Wiki/VTK/Examples

Take a look at the examples and screenshots for visualizing 3D and volume data to get some ideas.

dicktim
03-20-2017, 05:50 AM
thank you so much,
i start looking at the tutorial website, but i still cannot think how can i visualize my simulation.
Actually, my simulation is related to the physics, which is called the lattice model
you may assume the model is similar to the table below:
口口口口
口口口口
口口口口
口口口口
inside the table, there are 16 space, each space either is colored in white or black , which is represent +1 and -1 respectively.
And when the problem is running, the color will be changed, because of some physical reason,inside the array, some value will change from -1 -->+1, or +1 ---> - 1, but the main point is to visualize the +1 and -1 in white and black color.
So that i can have i look and see the insight of physics

Silence
03-20-2017, 09:22 AM
Something similar to this (https://github.com/tiagomnh/game-of-life/blob/master/src/main.cpp) should be far enough for you.