In wave/shape drawing code, we now preallocate the vertex buffer once for the maximum number of sides and only update the existing buffer instead of reallocating it over and over again. Trades a few KB of additional RAM for a good amount of drawing performance.
In the motion vector grid code, we only reallocate the buffer if we draw more vertices than in the previous draw call.
Also changed the drawing hint to GL_STREAM_DRAW, which is slightly better suited for this kind of usage (update once, draw once, repeat).
These changes should hopefully improve performance, especially when large numbers of custom shapes are drawn.
32 excess samples were read from the preset state in waveform modes. Didn't have any noticeable impact, but we should clearly not read over the end of an array.
Since we're using OpenGL, everything has to be done in the same thread anyways. Besides that, the actual "multithreading" implementation was basically starting an empty thread that did absolutely nothing, then wait synchronously for it to complete and join it on the next frame.
Also gets rid of the dirent.h hack used on Windows platforms, as the filesystem API hides all the OS-specific stuff, and we can use a recursive iterator instead of doing that ourselves, making the code even cleaner.
This did not have any real impact, as the excess bytes were written into the next buffer, which was then immediately "fixed up" during the following copy call with the correct data, but could cause a crash and other nasty things if someone would reorder the class members or insert something in between.
Waveform code was kindly provided and used with permission by Milkdrop2077.
Had to make a few amends though, as some sample offsets went over the allocated waveform sample count (>480), leading to memory issues.
Instead of using these expressions, adding "lib" in fron of static libs is now done via CMAKE_STATIC_LIBRARY_PREFIX when building static libs on Windows.
WebGL doesn't follow the OpenGL standard format for the glGetString(GL_SHADING_LANGUAGE_VERSION) return value. Chrome for example will return "OpenGL ES GLSL ES 3.00 (WebGL GLSL ES 3.00 (OpenGL ES GLSL ES 3.0 Chromium))", which does not start with the version number as the standard suggests.
This fix will simply cut off any text preceding the first digit found in the string, if any.