OpenGL JUCE app and GLUT

Hello! I’ve recently stumbled upon JUCE and am very excited to use it. I’m working on an OpenGL acoustic simulator in C++. I’ve already built it using DirectX (a few years back), but I’m wanting to make it more portable with JUCE. I’m hoping that this audio engine will be able to playback processed WAVE data without much latency. Anyhow, my simulator was originally built with GLUT and MFC. I’m now moving to freeglut and would loved to make it platform independent. There are a few hitches, though, that I cannot seem to get around. It seems that freeglut and JUCE are not compatible. I am very okay with using JUCE to do the windowing and handle most of the GUI. But drawing text in the 3D buffer (stroke, not bitmap) is very tricky without GLUT. When I try to include freeglut in an opengl template project and call any simple drawing function (e.g. glutSolidCube, etc…) the program crashes without any error message or feedback. I’m trying to trace it back, but without success.

I’ve also gone the other direction and created a strictly GLUT console app with JUCE attached to it, but getting the two threading systems to work with each other has been problematic at best. So, I’m good with using the juicer opengl template app. But I’d really like basic GLUT drawing functionality.

Any advise? Oh, using MSVC on Windows 10. I’ll be trying to port it to xCode and others later… Thoughts? Thanks!

1 Like

To be clear, I just tried to simply add the line “glutBitmapWidth(GLUT_BITMAP_8_BY_13, ‘g’);” to the end of the MainComponent::paint function. I can call gl and glu functions here, but when I call any GLUT function, it immediately crashes upon running, without any error message. I’ve tried tracing it and stepping, but to no avail. It seems to me like JUCE doesn’t play nice with 3rd party libraries. Please help! Thanks.

Never mind! Figured it out. It was really simple. FYI, if anyone runs into this problem, it was just a matter of initialitzing GLUT in the MainComponent::initialise function. Specifically:

int argc = 1;
char* argv[1] = { (char*)"Something" };
glutInit(&argc, argv);