Embedding manifest into the application binary breaks OpenGL 2

杀马特。学长 韩版系。学妹 提交于 2021-01-28 02:20:49

问题


My application uses OpenGL. Everything worked until today, when I embedded the following manifest into the .exe. I need it for the sole purpose of being able to get the current OS version with the isWindowsNOrGreater functions, which are capped at Windows 8 (not even 8.1) unless the application has explicitly specified support for Windows 8.1 and/or 10:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <assemblyIdentity 
        type="win32" 
        name="com.my.Test"
        version="1.0.0.0" 
    />
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
        <application> 
            <!-- Windows 10 --> 
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
            <!-- Windows 8.1 -->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
            <!-- Windows Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
            <!-- Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!-- Windows 8 -->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
        </application> 
    </compatibility>
</assembly>

As soon as I embed this manifest, I can no longer initialize OpenGL 2: wglGetProcAddress("wglCreateContextAttribsARB") returns null, and glGetString(GL_RENDERER) returns the dreaded "GDI Generic" instead of the actual hardware renderer.

What's going on, why does the manifest break OpenGL, and how I can I fix this?

来源:https://stackoverflow.com/questions/34676697/embedding-manifest-into-the-application-binary-breaks-opengl-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!