Reintegrate projectM Visualizer
-
@Gustavo-L-Conte
The crash I'm getting isn't related toprojectm_pcm_add_int16
, it's happens when callingprojectm_opengl_render_frame
, I suspect it's NVIDIA related. Problem is that all my computers have nvidia graphics. -
I suspect the reason why QGraphicsView and QGraphicsScene was used is because of some additional things like the play buttons overlay, using a QMainWindow with a QOpenGLWidget directly didn't change much for me, other than the play buttons no longer working. It was just an attempt to see if it would solve any issue.
-
ProjectMPresetModel should probably use projectm directly to present the presets, not hold it's own data. I'll work on that.
-
@jonas lol sry for bothering about that again, but:
Instead of removing the typecast I'm now casting to unsigned short, it works too
const unsigned int samples_per_channel = static_cast<unsigned short>(map.size) / sizeof(int16_t) / 2;
Thats the only segfault I get. yep, Maybe yours is NVIDIA related, because I have INTEL onboard graphics
Is there a way for you to activate software rendering and bypass the GPU, just to test?export QT_QUICK_BACKEND=software export LIBGL_ALWAYS_SOFTWARE=1
-
@jonas When i do this:
int current_preset_ = projectm_playlist_get_position(projectm_playlist_instance_); qLog(Debug) << "Rendering frame for preset: " << current_preset_; projectm_set_window_size(projectm_instance_, static_cast<size_t>(width * pixel_ratio_), static_cast<size_t>(height * pixel_ratio_)); projectm_opengl_render_frame(projectm_instance_);
and then set lets say, 5 seconds interval, selecting all presets
it DOES increment the index printed
16:22:06.329 DEBUG ProjectMVisualization:205 Rendering frame for preset: 4 16:22:06.346 DEBUG ProjectMVisualization:205 Rendering frame for preset: 4 16:22:06.362 DEBUG ProjectMVisualization:205 Rendering frame for preset: 4 16:22:06.380 DEBUG ProjectMVisualization:205 Rendering frame for preset: 4 16:22:06.396 DEBUG ProjectMVisualization:205 Rendering frame for preset: 4 16:22:06.413 DEBUG ProjectMVisualization:205 Rendering frame for preset: 4 16:22:06.429 DEBUG ProjectMVisualization:205 Rendering frame for preset: 4 16:22:06.446 DEBUG ProjectMVisualization:205 Rendering frame for preset: 4 16:22:06.463 DEBUG ProjectMVisualization:205 Rendering frame for preset: 4 16:22:06.480 DEBUG ProjectMVisualization:205 Rendering frame for preset: 4 16:22:06.496 DEBUG ProjectMVisualization:205 Rendering frame for preset: 4 16:22:06.513 DEBUG ProjectMVisualization:205 Rendering frame for preset: 5 16:22:06.530 DEBUG ProjectMVisualization:205 Rendering frame for preset: 5 16:22:06.546 DEBUG ProjectMVisualization:205 Rendering frame for preset: 5 16:22:06.563 DEBUG ProjectMVisualization:205 Rendering frame for preset: 5 16:22:06.580 DEBUG ProjectMVisualization:205 Rendering frame for preset: 5 16:22:06.596 DEBUG ProjectMVisualization:205 Rendering frame for preset: 5
-
@Gustavo-L-Conte said in Reintegrate projectM Visualizer:
export QT_QUICK_BACKEND=software export LIBGL_ALWAYS_SOFTWARE=1
Setting these variables didn't do anything, but I've managed to make it crash less often by reinstalling the nvidia driver.
If you pull the latest changes from the visualisations branch I've fixed loading saved presets, the IndexOfPreset function was also broken with projectM 4.
-
@jonas said in Reintegrate projectM Visualizer:
LIBGL_ALWAYS_SOFTWARE
just finishing building
these are MEsa variables:
-
@jonas I did not notice any difference running the app... except now it honours the selected presets. ( I think it "forgets" in previous versions, never understood what was going on)
Still no output, but here's a thing I saw:
[Visualizations] duration=30 geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0%\0\0\x6P\0\0\x3\x39\0\0\0\0\0\0\0%\0\0\x6P\0\0\x3\x39\0\0\0\0\0\0\0\0\a\x80\0\0\0\0\0\0\0%\0\0\x6P\0\0\x3\x39) mode=1 preset_paths=/usr/share//projectM/presets/Aderrasi - Agitator.milk, /usr/share//projectM/presets/Aderrasi - Aimless (Gravity Directive Mix).milk, /usr/share//projectM/presets/Aderrasi - Aimless (Spirogravity Mix).milk, /usr/share//projectM/presets/Aderrasi - Airhandler (Menagerie Mix).milk, /usr/share//projectM/presets/Aderrasi - Airs (Windy Mix).milk, /usr/share//projectM/presets/Aderrasi - Airs.milk, /usr/share//projectM/presets/Aderrasi - Anchorpulse (Pulse Of A Ghast II Mix).milk, /usr/share//projectM/presets/Aderrasi - Anchorpulse (Verified Mix).milk, /usr/share//projectM/presets/Aderrasi - Anomalous Material Science (Pure Splinter Mix).milk, /usr/share//projectM/presets/Aderrasi - Antidote (Aqualung Mix).milk,
This is my config file, is it supposed to be missing double quotes in the filenames?
-
QOpenGLFunctions::glGetError() returns GL_INVALID_ENUM (0x0501)
-
@jonas I saw this error code too before, at the time I tought we had to make OpenGL ES context but I never tried that
-
With ProjectM3 I do not get that error code, but on some presets I get
GL_INVALID_OPERATION
. -
@jonas
ProjectMGUI::initialize
(SDL2 frontend)_projectMWrapper = &projectMWrapper; _renderingWindow = renderingWindow.GetRenderingWindow(); _glContext = renderingWindow.GetGlContext(); ImGui_ImplSDL2_InitForOpenGL(_renderingWindow, _glContext); ImGui_ImplOpenGL3_Init("#version 130"); UpdateFontSize();
by settiing this version part could do the trick maybe?
-
But that code is using ImGui?
I actually got some presets from the original pack (https://github.com/projectM-visualizer/presets-projectm-classic) to work with ProjectM version 4 now using Qt 5 and QGLWidget. The ones starting with "Martin", but a few others too. No crashes either.
With Qt 6 and QOpenGLWidget, none of them work, and I also see crashes. -
@jonas I did the version stuff in the initializeGL, tested with qLog if it was setting the version, it did, and it didnt change anything.....
I'm thinking now, maybe these crashes could be some sort of related to overhead? It would be a shot in the dark again, but maybe increase the intervals? in the timer formulae
-
@jonas said in Reintegrate projectM Visualizer:
I actually got some presets from the original pack (https://github.com/projectM-visualizer/presets-projectm-classic) to work with ProjectM version 4 now using Qt 5 and QGLWidget. The ones starting with "Martin", but a few others too. No crashes either.
With Qt 6 and QOpenGLWidget, none of them work, and I also see crashes.tomorrow I'm going to clone the classic presets... if the ones I was using arent already, I got from steam and/or ubuntu packages;
I was able to make qt6 work with v3 today, remember? I believe using visualizations2 branch.
Had to force QStringLiterals all over the place to make it run, but perphaps with your fixes today it wont be necessary anymore. It was mainly paths: fontfile, preset, texture, etc;Its good try to test with the same suite of presets, obviously.
Its very nice that you advanced making v4 work at all! I need to rest, but tomorrow I'm going to test both visualizations latest and visualizations2 if necessary.
tkssssss nice job
qt6 llibprojectM v3 with visualizations2 branchI found another "hint" for the puzzle, on the qt frontend of projectM repo
void resizeGL ( int w, int h ) override { // Setup viewport, projection etc setup_opengl ( w,h ); projectm_set_window_size(m_projectM->instance(), static_cast<size_t>(w), static_cast<size_t>(h)); } void setup_opengl ( int w, int h ) { /* Our shading model--Gouraud (smooth). */ glShadeModel ( GL_SMOOTH ); /* Culling. */ // glCullFace( GL_BACK ); // glFrontFace( GL_CCW ); // glEnable( GL_CULL_FACE ); /* Set the clear color. */ glClearColor ( 0, 0, 0, 0 ); /* Setup our viewport. */ glViewport ( 0, 0, w, h ); /* * Change to the projection matrix and set * our viewing volume. */ glMatrixMode ( GL_TEXTURE ); glLoadIdentity(); // gluOrtho2D(0.0, (GLfloat) width, 0.0, (GLfloat) height); glMatrixMode ( GL_PROJECTION ); glLoadIdentity(); // glFrustum(0.0, height, 0.0,width,10,40); glMatrixMode ( GL_MODELVIEW ); glLoadIdentity(); glDrawBuffer ( GL_BACK ); glReadBuffer ( GL_BACK ); glEnable ( GL_BLEND ); glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); // glBlendFunc(GL_SRC_ALPHA, GL_ONE); glEnable ( GL_LINE_SMOOTH ); glEnable ( GL_POINT_SMOOTH ); glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f ); // glClear(GL_COLOR_BUFFER_BIT); // glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGB,0,0,texsize,texsize,0); //glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,texsize,texsize); glLineStipple ( 2, 0xAAAA ); }
https://github.com/projectM-visualizer/frontend-qt/blob/master/src/common/qprojectmwidget.hpp
Hope it helps; we can use QOpenGLFunctions.h for that procedure. Maybe this is just whats missing for us now in terms of black/blank screen............................
-
@Gustavo-L-Conte said in Reintegrate projectM Visualizer:
/* Our shading model--Gouraud (smooth). /
glShadeModel ( GL_SMOOTH );
/ Culling. /
// glCullFace( GL_BACK );
// glFrontFace( GL_CCW );
// glEnable( GL_CULL_FACE );
/ Set the clear color. /
glClearColor ( 0, 0, 0, 0 );
/ Setup our viewport. /
glViewport ( 0, 0, w, h );
/
* Change to the projection matrix and set
* our viewing volume.
*/
glMatrixMode ( GL_TEXTURE );
glLoadIdentity();// gluOrtho2D(0.0, (GLfloat) width, 0.0, (GLfloat) height); glMatrixMode ( GL_PROJECTION ); glLoadIdentity(); // glFrustum(0.0, height, 0.0,width,10,40); glMatrixMode ( GL_MODELVIEW ); glLoadIdentity(); glDrawBuffer ( GL_BACK ); glReadBuffer ( GL_BACK ); glEnable ( GL_BLEND ); glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); // glBlendFunc(GL_SRC_ALPHA, GL_ONE); glEnable ( GL_LINE_SMOOTH ); glEnable ( GL_POINT_SMOOTH ); glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
// glClear(GL_COLOR_BUFFER_BIT);
// glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGB,0,0,texsize,texsize,0); //glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,texsize,texsize); glLineStipple ( 2, 0xAAAA );
after making lotsa tests with this idea of "preparing" opengl I've decided to debug the preset loading, it seems something is wrong with the "current" preset, it never starts. I did some serious qLog debugging messages, it appears that it loads the presets correctly but the playlist never starts, not even the M logo. tomorrow I'll try to understand this better....
-
I've made a much more minimal test project here for debugging:
https://github.com/jonaski/ProjectMTest -
@jonas said in Reintegrate projectM Visualizer:
I've made a much more minimal test project here for debugging:
https://github.com/jonaski/ProjectMTestAwesome idea! Without v4, I always get these errors both in Strawberry and also now in the testproject:
~/ProjectMTest/build$ ./projectmtest No Textures Loaded from "/usr"/share/projectM/textures Could not open font file:
What I'm doing to bypass it is kinda bizarre.
mkdir -p \"/usr\"/share/projectM
for the first error, then I copy stuff to that bizarre new local dir.
For the fonts, I just force the filename to some ttf in /fonts with QStringLiteral and .toStdString(); in the settings s structure, vars are menuFontURL and titleFontURL
I really do not understand where this double quotes come from, neither why I'm having to set the fonts filename by hand. Do you think maybe v3 is trying to read from a config file i do not have?
-
its hard-coded on my lib from Ubuntu package
I'll see if it fixes by recompiling it by hand
~/ProjectMTest/build$ strings /usr/lib/libprojectM.so | xargs -0 | grep \"/usr
Smooth Preset DuHard Cut SensitiAspect CorrectioEaster Egg ParamSoft Cut Ratingsidle://Geiss & Sperl - Feedback (projectM idle Hle HDR mix).milkSmooth Transitionsition Duration
"/usr"/share/proprojectM/presets "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansaVuSansMono.ttf"
edit: I'm so stupid, the ubuntu package is v2 not v3 LoL just realized it now
-
Okey, got libprojectM v2.10 and v3.12 from sourceforge and...
Looks like v 3.12 works like a charm in the test program. Didn't need to do anything, out-of-the-box. Some presets seem "idle" maybe because they are not fed by any data? there is no ConsumeBuffer right?
about v2.10 compiled by hand: it gave some trouble to compile, had to fix some stuff in the source for it to compile,also fiddle with src/CMakeLists.txt to avoid trying to detect things we dont need in this context. Amazing:
~/ProjectMTest/build$ ./projectmtest No Textures Loaded from "/usr"/share/projectM/textures Could not open font file:
Something is really messed up with that v2.10, not just in Ubuntu now I see
~/ProjectMTest/build$ ls -la /usr/lib/libprojectM.so.2 lrwxrwxrwx 1 root root 20 jun 30 21:29 /usr/lib/libprojectM.so.2 -> libprojectM.so.2.1.0 ~/ProjectMTest/build$ date dom 30 jun 2024 21:31:32 -03 ~/ProjectMTest/build$ strings /usr/lib/libprojectM.so.2 | grep usr\/share "/usr/share/projectM/fonts/Vera.ttf" "/usr/share/projectM/fonts/VeraMono.ttf" ~/ProjectMTest/build$ strings /usr/lib/libprojectM.so.2 | grep usr\"\/share "/usr"/share/projectM/presets "/usr"/share/projectM/textures
edit: Found the reason!
in v2.10 It defines the path here,
line 279 src/libprojectM/Renderer/TextureManager.cppvoid TextureManager::loadTextureDir() { std::string dirname = CMAKE_INSTALL_PREFIX "/share/projectM/textures";
the CMAKE_INSTALL_PREFIX is being set with the double quotes, probably some REGEX replace on cmake