Git Product home page Git Product logo

mauricegit / partikel_accelleration_on_gpu Goto Github PK

View Code? Open in Web Editor NEW
256.0 10.0 22.0 25.47 MB

Particle accelleration with OpenGL 4.3, using the compute shader to calculate particle movement on graphics hardware.

License: ISC License

GLSL 0.01% Shell 0.01% C 68.90% Makefile 0.01% CMake 0.63% CSS 0.57% HTML 27.81% JavaScript 0.56% Objective-C 0.91% M 0.14% Mathematica 0.45%
particle-simulation opengl compute-shaders particles c glsl

partikel_accelleration_on_gpu's Introduction

Particle-Simulation using the GPU via the OpenGL Compute-Shader

This particle simulation is more like a proof of concept for myself or others, to show and understand how compute shaders in OpenGL work. Using the knowledge I gathered from this project, more complex, fascinating and fast projects are possible, which use the power of the graphics hardware for computations.

The final result looks like that:

Particle-Simulation

Animation

Each particle has a life span in which it fades from red (new born) to blue (about dying). When a particle dies, it respawnes in its negated (x,y,z) position.

The movement itself is computed using an Euler integration method for each particle.

There are several global randomly moving attraction points. Particles are attracted and accelerated by these points.

Example screenshots:

Particle-Simulation Particle-Simulation Particle-Simulation

Install && Run

I tested an ran this simulation on a debian-based Linux OS (Ubuntu, Mint, ...). It should run on other machines as well but is not tested.

System Requirements

The following system attributes are required for running this simulation:

  • A graphics card supporting OpenGL version 4.3 (For the compute-shader!).

  • Unix-Libraries: xorg-dev and mesa-common-dev

Both GLEW (The OpenGL Extension Wrangler Library) and GLFW (Window-Manager) are now included locally, so no system wide installation is necessary!

For a system wide installation, further information is available under the following links:

Running

Compiling and running should work under windows. OSX is not supported as the available OpenGL version does not reach 4.3. In the root directory, execute:

  • cmake .

  • make

  • cd bin/

  • ./particleSim

While the simulation runs, you can move around (always looking to the center!) with your mouse (left-klick and move) and zoom in/out with your mouse (right click and move up/down).

More Screenshots

So, here are some more screenshots, because screenshots are awesome :)

Particle-Simulation Particle-Simulation Particle-Simulation Particle-Simulation Particle-Simulation Particle-Simulation Particle-Simulation Particle-Simulation Particle-Simulation

You can find some more screenshots in the screenshot-folder: More Screenshots :).

partikel_accelleration_on_gpu's People

Contributors

arsv avatar hiiyl avatar mauricegit avatar menaceinc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

partikel_accelleration_on_gpu's Issues

G_Attractor_Mass initialization

It seems G_Attractor_Mass initialization is missing... or am I wrong?

Because it should be null when you try to assign it to the vec.w

vec.w = G_Attractor_Mass[i];

running errors: GLSL 4.30 is not supported.

When running the codes, it showed the errors

Status: Using GLEW 1.13.0
--> Shader laden...
Compiling Vertex shader
vertexShaderErrorMessage: 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

Compiling Fragment shader
fragmentShaderErrorMessage: 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

programErrorMessage: error: linking with uncompiled/unspecialized shadererror: linking with uncompiled/unspecialized shader
Compiling Compute shader
computeShaderErrorMessage: 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES
0:0(0): error: Compute shaders require GLSL 4.30 or GLSL ES 3.10

Then, I checked my computer with glxinfo and it shows

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics (CHV)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.2.6
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 20.2.6
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 20.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:

It seems that my computer supports 4.6 Core profile. How do I know if my computer supports GLSL 4.30 or not? Thank you!

Compile Error In Shader

I am trying to run The Legend Of Zelda: Breath of the Wild on my PC with cemu but it crashes when it loads. My log looks like this:

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

[20:27:21] Compile error in shader. Log:
[20:27:21] 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES

any Help?

Flickering

Hi, I compiled and ran your program, it works but I get a lot of flickering (blue, red, blue, red). I would like to know if you have the same problem.

I am using Ubuntu.

Thanks in advance.

Wont run Mac os

Status: Using GLEW 1.13.0
--> Shader laden...
Compiling Vertex shader
vertexShaderErrorMessage: ERROR: 0:1: '' :  version '430' is not supported
ERROR: 0:1: '' : syntax error: #version
ERROR: 0:3: 'layout' : syntax error: syntax error

Compiling Fragment shader
fragmentShaderErrorMessage: ERROR: 0:1: '' :  version '430' is not supported
ERROR: 0:1: '' : syntax error: #version

programErrorMessage: ERROR: One or more attached shaders not successfully compiled

Returns this error after trying to run on imac with radeon 290m.

I can't compile it

I get this:

xorg and mesa already installed..

elect@elect-desktop:~/NetBeansProjects$ git clone https://github.com/MauriceGit/Partikel_accelleration_on_GPU.git Partikel_accelleration_on_GPU
Cloning into 'Partikel_accelleration_on_GPU'...
remote: Counting objects: 567, done.
remote: Total 567 (delta 0), reused 0 (delta 0), pack-reused 567
Receiving objects: 100% (567/567), 25.47 MiB | 2.11 MiB/s, done.
Resolving deltas: 100% (227/227), done.
Checking connectivity... done.
elect@elect-desktop:~/NetBeansProjects$ cd Partikel_accelleration_on_GPU/
elect@elect-desktop:~/NetBeansProjects/Partikel_accelleration_on_GPU$ cmake^Cke
elect@elect-desktop:~/NetBeansProjects/Partikel_accelleration_on_GPU$ cmake.
No command 'cmake.' found, did you mean:
 Command 'cmake' from package 'cmake' (main)
cmake.: command not found
elect@elect-desktop:~/NetBeansProjects/Partikel_accelleration_on_GPU$ cmake .
-- The C compiler identification is GNU 5.2.1
-- The CXX compiler identification is GNU 5.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so  
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Using X11 for window creation
-- Using GLX for context creation
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Looking for glXGetProcAddress
-- Looking for glXGetProcAddress - not found
-- Looking for glXGetProcAddressARB
-- Looking for glXGetProcAddressARB - not found
-- Looking for glXGetProcAddressEXT
-- Looking for glXGetProcAddressEXT - not found
CMake Warning at lib/glfw-3.1.1/CMakeLists.txt:403 (message):
  No glXGetProcAddressXXX variant found


-- Looking for dlopen
-- Looking for dlopen - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/elect/NetBeansProjects/Partikel_accelleration_on_GPU
elect@elect-desktop:~/NetBeansProjects/Partikel_accelleration_on_GPU$ make
Scanning dependencies of target glfw
[  1%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/context.c.o
[  3%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/init.c.o
[  5%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/input.c.o
[  6%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/monitor.c.o
[  8%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/window.c.o
[ 10%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/x11_init.c.o
[ 11%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/x11_monitor.c.o
[ 13%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/x11_window.c.o
[ 15%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/xkb_unicode.c.o
[ 16%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/linux_joystick.c.o
[ 18%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/posix_time.c.o
[ 20%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/posix_tls.c.o
[ 22%] Building C object lib/glfw-3.1.1/src/CMakeFiles/glfw.dir/glx_context.c.o
In file included from /home/elect/NetBeansProjects/Partikel_accelleration_on_GPU/lib/glfw-3.1.1/src/x11_platform.h:63:0,
                 from /home/elect/NetBeansProjects/Partikel_accelleration_on_GPU/lib/glfw-3.1.1/src/internal.h:85,
                 from /home/elect/NetBeansProjects/Partikel_accelleration_on_GPU/lib/glfw-3.1.1/src/glx_context.c:28:
/home/elect/NetBeansProjects/Partikel_accelleration_on_GPU/lib/glfw-3.1.1/src/glx_context.c: In function ‘_glfwPlatformGetProcAddress’:
/home/elect/NetBeansProjects/Partikel_accelleration_on_GPU/lib/glfw-3.1.1/src/glx_context.c:541:36: warning: pointer targets in passing argument 2 of ‘dlsym’ differ in signedness [-Wpointer-sign]
     return _glfw_glXGetProcAddress((const GLubyte*) procname);
                                    ^
/home/elect/NetBeansProjects/Partikel_accelleration_on_GPU/lib/glfw-3.1.1/src/glx_context.h:54:60: note: in definition of macro ‘_glfw_glXGetProcAddress’
  #define _glfw_glXGetProcAddress(x) dlsym(_glfw.glx.libGL, x)
                                                            ^
In file included from /home/elect/NetBeansProjects/Partikel_accelleration_on_GPU/lib/glfw-3.1.1/src/glx_context.h:41:0,
                 from /home/elect/NetBeansProjects/Partikel_accelleration_on_GPU/lib/glfw-3.1.1/src/x11_platform.h:63,
                 from /home/elect/NetBeansProjects/Partikel_accelleration_on_GPU/lib/glfw-3.1.1/src/internal.h:85,
                 from /home/elect/NetBeansProjects/Partikel_accelleration_on_GPU/lib/glfw-3.1.1/src/glx_context.c:28:
/usr/include/dlfcn.h:64:14: note: expected ‘const char * restrict’ but argument is of type ‘const GLubyte * {aka const unsigned char *}’
 extern void *dlsym (void *__restrict __handle,
              ^
Linking C static library libglfw3.a
[ 22%] Built target glfw
Scanning dependencies of target particleSim
[ 23%] Building C object CMakeFiles/particleSim.dir/src/imageLoader.c.o
[ 25%] Building C object CMakeFiles/particleSim.dir/src/io.c.o
[ 27%] Building C object CMakeFiles/particleSim.dir/src/logic.c.o
[ 28%] Building C object CMakeFiles/particleSim.dir/src/main.c.o
[ 30%] Building C object CMakeFiles/particleSim.dir/src/scene.c.o
[ 32%] Building C object CMakeFiles/particleSim.dir/src/vector.c.o
[ 33%] Building C object CMakeFiles/particleSim.dir/lib/glew-1.13.0/src/glew.c.o
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libGL.so', needed by 'bin/particleSim'.  Stop.
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/particleSim.dir/all' failed
make[1]: *** [CMakeFiles/particleSim.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2
elect@elect-desktop:~/NetBeansProjects/Partikel_accelleration_on_GPU$ 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.