forked from Mirrors/openclonk
GL: Correctly encode error strings
gluErrorString returns latin-1 encoded strings. Our code expects to receive UTF-8 encoded strings everywhere, so make sure that the strings are converted before passing them on.issue1247
parent
49997045f6
commit
eed1c43b8a
|
@ -683,7 +683,16 @@ bool CStdGL::CheckGLError(const char *szAtOp)
|
|||
{
|
||||
GLenum err = glGetError();
|
||||
if (!err) return true;
|
||||
LogF("GL error with %s: %d - %s", szAtOp, err, gluErrorString(err));
|
||||
|
||||
#ifdef USE_WIN32_WINDOWS
|
||||
StdStrBuf err_buf(gluErrorUnicodeStringEXT(err));
|
||||
#else
|
||||
// gluErrorString returns latin-1 strings. Our code expects UTF-8, so convert
|
||||
StdStrBuf err_buf(gluErrorString(err));
|
||||
err_buf.EnsureUnicode();
|
||||
#endif
|
||||
|
||||
LogF("GL error with %s: %d - %s", szAtOp, err, err_buf.getData());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -197,6 +197,7 @@ protected:
|
|||
friend class C4StartupOptionsDlg;
|
||||
friend class C4FullScreen;
|
||||
friend class C4Window;
|
||||
friend class C4ShaderCall;
|
||||
};
|
||||
|
||||
// Global access pointer
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "C4Include.h"
|
||||
#include "C4Shader.h"
|
||||
#include "C4Application.h"
|
||||
#include "graphics/C4DrawGL.h"
|
||||
|
||||
struct C4ShaderPosName {
|
||||
int Position; const char *Name;
|
||||
|
@ -549,8 +550,5 @@ void C4ShaderCall::Finish()
|
|||
fStarted = false;
|
||||
|
||||
// Got an error?
|
||||
if(int err = glGetError())
|
||||
{
|
||||
LogF("GL error: %d - %s", err, gluErrorString(err));
|
||||
}
|
||||
pGL->CheckGLError("C4ShaderCall::Finish()");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue