This repository has been archived on 2024-12-30. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2024CG-project-render/include/print_program_info_log.h
github-classroom[bot] 686dcaf351
Initial commit
2024-11-29 09:50:03 +00:00

36 lines
775 B
C++

#ifndef PRINT_PROGRAM_INFO_LOG_H
#define PRINT_PROGRAM_INFO_LOG_H
#include <string>
// Print information about a given glsl shader program.
//
// Inputs:
// obj id of object we're querying
// Returns true if printed anything.
bool print_program_info_log(const GLuint obj);
// Implementation
#include "REDRUM.h"
#include "STR.h"
bool print_program_info_log(const GLuint obj)
{
GLint infologLength = 0;
GLint charsWritten = 0;
glGetProgramiv(obj, GL_INFO_LOG_LENGTH,&infologLength);
if (infologLength > 0)
{
char * infoLog = new char[infologLength];
glGetProgramInfoLog(obj, infologLength, &charsWritten, infoLog);
std::string log(infoLog);
std::cerr<<log<<std::endl;
delete[] infoLog;
return true;
}
return false;
}
#endif