zturtleman / mm3d

Maverick Model 3D is a 3D model editor and animator for games.
https://clover.moe/mm3d
GNU General Public License v2.0
115 stars 23 forks source link

Qt may disable OpenGL on Windows #69

Closed zturtleman closed 4 years ago

zturtleman commented 5 years ago

Qt blacklists some OpenGL drivers on Windows and has QOpenGLFunctions instead use ANGLE (Direct3D) or LLVMpipe software renderer. However MM3D uses OpenGL directly and so it just has a black model viewports and texture widgets since Qt doesn't initialize OpenGL.

MM3D only uses OpenGL 1.1 so it should be safe to always use OpenGL. So the blacklist needs to be disabled. This can be done by overriding blacklist with environment variable (QT_OPENGL_BUGLIST) pointing to an empty file. I need to see if I can set it in MM3D and if the file actually has to exist.

zturtleman commented 5 years ago

Okay, actually it seems like I just need to add the following to src/implui/qtmain.cc before ModelApp:

   QCoreApplication::setAttribute( Qt::AA_UseDesktopOpenGL );

:confetti_ball:

Need to setup Windows compiling again and test it.

m-7761 commented 5 years ago

Is using OpenGL 1.1 a goal? Today I learned glColor doesn't work with glDrawPixels on my Intel system. I think these older OpenGL pathways may be a vice instead of a virtue, even though I hate to loose Indirect GLX support, neither do I relish coding multiple pathways. It seems that basically everything in Indirect GLX is legacy, and even though legacy is supposed to be supported, in practice I expect it's unreliable, and the landscape will only get worse. I think the sentiment for OpenGL itself is that it's not thought of as a living API at this stage. I don't know.

zturtleman commented 5 years ago

glDrawPixels puts pixels in the framebuffer (I don't know when this would be useful). As far as I know it's not part of the fixed-function rendering pipeline (glBlendFunc, glAlphaFunc, glBegin, glVertex, glColor, glEnd, ...).

OpenGL 1.1 only hardware is probably ~17 to 23 years old. Any reason to support this? Probably not. I doubt much other software does and Maverick / Qt 5 may not run on whatever ancient OS it may be running. (Someone did recently pop up with a IRIX OpenGL 1.1 system wanting to run ioquake3 which still supports OpenGL 1.1 but this case is truly an outlier.)

The only place that a person is likely to encounter OpenGL 1.x is Microsoft's default OpenGL 1.1 driver that is implemented using Direct3D. At which point it's probably just as well to use OpenGL ES 2 with ANGLE over Direct3D.

Switching to OpenGL ES 2 (and/or OpenGL 3.2 Core Profile) compatible rendering would require rewriting all of the existing OpenGL drawing code in Maverick. This opens potential for running on a Raspberry Pi (ES 2) and laying the ground work for physically-based rendering or other shader effects (does anyone care to deal with integrating physically-based rendering with existing MM3D / OpenGL 1 material system?). Overall there isn't much of an argument for investing the time to do this.

I don't really see the benefit of making minor changes to Maverick that require beyond OpenGL 1.1 (optional features would be fine but I'm not particularly interested in working on the GL 1.x code). If someone asks why OpenGL 1.x doesn't work anymore I don't want to respond with "I couldn't be bothered and it doesn't really offer any new rendering over Misfit."

zturtleman commented 4 years ago

Fixed in https://github.com/zturtleman/mm3d/commit/8c6c6ea29e2ad423d35ed1c2147f09c68f49d94b.