using log calls

This commit is contained in:
2022-07-14 18:32:32 +02:00
parent 66376eaeda
commit d6fbb58da8
8 changed files with 39 additions and 38 deletions

View File

@@ -6,10 +6,13 @@
*/
#include "render/shaders/ShaderProgram.h"
#include "misc/Log.h"
#include "misc/Format.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include <glm/gtc/type_ptr.hpp>
@@ -39,7 +42,7 @@ void ShaderProgram::Stop() const {
int ShaderProgram::GetUniformLocation(const std::string& uniformName) const {
const int location = glGetUniformLocation(m_ProgramID, uniformName.c_str());
if (location == -1) {
std::cout << "Warning ! Uniform variable " << uniformName << " not found !\n";
utils::LOGD(utils::format("Warning ! Uniform variable %s not found !", uniformName.c_str()));
}
return location;
}
@@ -118,15 +121,14 @@ unsigned int ShaderProgram::LoadShader(const std::string& source, GLenum type) {
GLint compilesuccessful;
glGetShaderiv(shaderID, GL_COMPILE_STATUS, &compilesuccessful);
if (compilesuccessful == false) {
std::cout << "Could not compile shader !\n";
GLsizei size;
glGetShaderiv(shaderID, GL_INFO_LOG_LENGTH, &size);
std::vector<char> shaderError(static_cast<std::size_t>(size));
glGetShaderInfoLog(shaderID, size, &size, shaderError.data());
std::cout << shaderError.data() << std::endl;
#ifdef __ANDROID__
__android_log_print(ANDROID_LOG_ERROR, "TRACKERS", "Could not compile shader !\n %s", error);
#endif
utils::LOG("Could not compile shader !");
utils::LOG(shaderError.data());
}
return shaderID;
}