diff README.md @ 21:8a5a7aee69ce

add description
author Dennis C. M. <dennis@denniscm.com>
date Tue, 27 Jun 2023 20:04:25 +0100
parents 074bde2db09a
children bebd95177e96
line wrap: on
line diff
--- a/README.md	Mon Jun 26 18:12:03 2023 +0100
+++ b/README.md	Tue Jun 27 20:04:25 2023 +0100
@@ -1,7 +1,34 @@
 # algo-animator
 
-## Compile and run
+This project is inspired by - off course - the video by Timo Bingmann called [15 sorting algorithms in 6 minutes](https://www.youtube.com/watch?v=kPRA0W1kECg).
+
+## Compile
+
 ```bash
 gcc main.c -lglut -lGL -lGLU -lm -I/usr/local/include/freetype2 -L/usr/local/lib -lfreetype
-./a.out
 ```
+
+## To improve
+
+Since `GLUT` is single-thread, I cannot call `glutPostRedisplay()` within `while` or `for loops` to redraw the screen in every 
+step of the selected sorting algorithm. I guess the solution is multi-threading, so I can perform the sorting in the second thread
+and post notifications to the main thread to redraw the screen.   
+
+Since this is my first OpenGL project and just my second program in C, I am tired and I don't want to spend more time in this project, 
+but maybe in the future I'll do it. Right now there are just two algorithms supported. I've implemented them in a way that every function
+call is a single step of the sorting. So, storing the "state" outside the function, I can use `idle()` as the loop of the sorting algorithm.   
+
+Let's say we selected `bubble sort`. Once you press `ENTER`, the process will be like this:
+
+```c
+run = true;
+bubble_sort();
+glutPostRedisplay;
+bubble_sort();
+glutPostRedisplay;
+bubble_sort();
+glutPostRedisplay;
+
+// Continue until the array is sorted
+run = false;
+```