forked from Mirrors/openclonk
Fix rendering on pre-3.2 hardware (#1459)
commit
36aa83b128
|
@ -317,17 +317,6 @@ CStdGLCtx *CStdGL::CreateContext(C4Window * pWindow, C4AbstractApp *pApp)
|
|||
const char *gl_version = reinterpret_cast<const char *>(glGetString(GL_VERSION));
|
||||
LogF("GL %s on %s (%s)", gl_version ? gl_version : "", gl_renderer ? gl_renderer : "", gl_vendor ? gl_vendor : "");
|
||||
|
||||
// Our shader-based skinning doesn't work on some Intel devices.
|
||||
// Those devices return an OpenGL 3.1 context even though we
|
||||
// request a 3.2 one; in this case, do CPU-based skinning instead.
|
||||
{
|
||||
assert(gl_version != NULL);
|
||||
int major, minor;
|
||||
sscanf(gl_version, "%d.%d", &major, &minor);
|
||||
if (major < 3 || (major == 3 && minor < 2))
|
||||
Workarounds.ForceSoftwareTransform = true;
|
||||
}
|
||||
|
||||
if (Config.Graphics.DebugOpenGL)
|
||||
{
|
||||
// Dump extension list
|
||||
|
|
|
@ -320,15 +320,32 @@ bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *pApp)
|
|||
// create context
|
||||
if (wglCreateContextAttribsARB)
|
||||
{
|
||||
const int attribs[] = {
|
||||
WGL_CONTEXT_FLAGS_ARB, Config.Graphics.DebugOpenGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, REQUESTED_GL_CTX_MAJOR,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, REQUESTED_GL_CTX_MINOR,
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
0
|
||||
};
|
||||
{
|
||||
const int attribs[] = {
|
||||
WGL_CONTEXT_FLAGS_ARB, Config.Graphics.DebugOpenGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, REQUESTED_GL_CTX_MAJOR,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, REQUESTED_GL_CTX_MINOR,
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
0
|
||||
};
|
||||
|
||||
hrc = wglCreateContextAttribsARB(hDC, 0, attribs);
|
||||
hrc = wglCreateContextAttribsARB(hDC, 0, attribs);
|
||||
}
|
||||
|
||||
if (!hrc)
|
||||
{
|
||||
LogSilentF(" gl: OpenGL %d.%d not available; falling back to 3.1 emergency context.", REQUESTED_GL_CTX_MAJOR, REQUESTED_GL_CTX_MINOR);
|
||||
// Some older Intel drivers don't support OpenGL 3.2; we don't use (much?) of
|
||||
// that so we'll request a 3.1 context as a fallback.
|
||||
const int attribs[] = {
|
||||
WGL_CONTEXT_FLAGS_ARB, Config.Graphics.DebugOpenGL ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
|
||||
0
|
||||
};
|
||||
pGL->Workarounds.ForceSoftwareTransform = true;
|
||||
hrc = wglCreateContextAttribsARB(hDC, 0, attribs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace
|
|||
}
|
||||
|
||||
if (pGL->Workarounds.ForceSoftwareTransform)
|
||||
buf = StdCopyStrBuf("#define OC_WA_FORCE_SOFTWARE_TRANSFORM\n") + buf;
|
||||
buf.Take(StdStrBuf("#define OC_WA_FORCE_SOFTWARE_TRANSFORM\n") + buf);
|
||||
|
||||
if (LowMaxVertexUniformCount)
|
||||
return StdStrBuf("#define OC_WA_LOW_MAX_VERTEX_UNIFORM_COMPONENTS\n") + buf;
|
||||
|
@ -664,7 +664,7 @@ namespace
|
|||
{
|
||||
// If the first bone assignment has a weight of 0, all others are zero
|
||||
// as well, or the loader would have overwritten the assignment
|
||||
if (in.bone_weight[0] == 0.0f)
|
||||
if (in.bone_weight[0] == 0.0f || mesh_instance.GetBoneCount() == 0)
|
||||
{
|
||||
out->x = in.x;
|
||||
out->y = in.y;
|
||||
|
|
Loading…
Reference in New Issue