mirror of https://github.com/axmolengine/axmol.git
Merge pull request #14965 from elloop/fix_opengl_log_function
fix opengl log function.
This commit is contained in:
commit
93d331f1e8
|
@ -587,17 +587,15 @@ void GLProgram::use()
|
|||
|
||||
static std::string logForOpenGLShader(GLuint shader)
|
||||
{
|
||||
std::string ret;
|
||||
GLint logLength = 0, charsWritten = 0;
|
||||
GLint logLength = 0;
|
||||
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logLength);
|
||||
if (logLength < 1)
|
||||
return "";
|
||||
|
||||
char *logBytes = (char*)malloc(logLength + 1);
|
||||
glGetShaderInfoLog(shader, logLength, &charsWritten, logBytes);
|
||||
logBytes[logLength] = '\0';
|
||||
ret = logBytes;
|
||||
char *logBytes = (char*)malloc(sizeof(char) * logLength);
|
||||
glGetShaderInfoLog(shader, logLength, nullptr, logBytes);
|
||||
std::string ret(logBytes);
|
||||
|
||||
free(logBytes);
|
||||
return ret;
|
||||
|
@ -605,17 +603,15 @@ static std::string logForOpenGLShader(GLuint shader)
|
|||
|
||||
static std::string logForOpenGLProgram(GLuint program)
|
||||
{
|
||||
std::string ret;
|
||||
GLint logLength = 0, charsWritten = 0;
|
||||
GLint logLength = 0;
|
||||
|
||||
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength);
|
||||
if (logLength < 1)
|
||||
return "";
|
||||
|
||||
char *logBytes = (char*)malloc(logLength + 1);
|
||||
glGetProgramInfoLog(program, logLength, &charsWritten, logBytes);
|
||||
logBytes[logLength] = '\0';
|
||||
ret = logBytes;
|
||||
char *logBytes = (char*)malloc(sizeof(char) * logLength);
|
||||
glGetProgramInfoLog(program, logLength, nullptr, logBytes);
|
||||
std::string ret(logBytes);
|
||||
|
||||
free(logBytes);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue