I’m enabling an OpenGL context for my component, but on some computers it just gives a black window. Any ideas on how to detect this?
Comment says:
// some stupidly old drivers are missing this function, so try to at least avoid a crash here,
// but if you hit this assertion you may want to have your own version check before using the
// component rendering stuff on such old drivers.
jassert (context.extensions.glActiveTexture != nullptr);
If I test just after openGLContext.attachTo()
I get 0xcdcdcdcd
meaning the variable hasn’t been initialized yet, so I can’t test here. If I call context.extensions.initialise()
and then test, I get nullptr
even if the system has OpenGL. So I can’t do that.
Only thing I’ve found that works is starting a timer, and then checking glActiveTexture
. This way I still get the assert, but at least I know OpenGL isn’t working and can fall back to software rendering.
But this seems dangerous since the thread that starts up OpenGL might be slow and happen after my timer fires.
Is there any fool proof way to know if OpenGL works or not?