OpenGL logging

Print warning if OpenGL logging is disabled but loglevel is too low
Fix format of printed functions

Closes 656
This commit is contained in:
Alexander Bock
2018-07-13 16:22:24 -04:00
parent d0f3e5507a
commit 1e97bae229
4 changed files with 35 additions and 26 deletions

View File

@@ -38,7 +38,7 @@ namespace openspace {
namespace documentation { struct Documentation; }
class SceneGraphNode;
class RenderData;
struct RenderData;
class LightSource : public properties::PropertyOwner {
public:

View File

@@ -89,9 +89,8 @@ float CameraLightSource::intensity() const {
return _intensity;
}
glm::vec3 CameraLightSource::directionViewSpace(const RenderData& renderData) const {
glm::vec3 CameraLightSource::directionViewSpace(const RenderData&) const {
return glm::vec3(0.f, 0.f, 1.f);
}
} // namespace openspace

View File

@@ -162,11 +162,11 @@ documentation::Documentation RenderableModel::Documentation() {
RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _colorTexturePath(TextureInfo)
, _ambientIntensity(AmbientIntensityInfo, 0.2, 0.0, 1.0)
, _diffuseIntensity(DiffuseIntensityInfo, 1.0, 0.0, 1.0)
, _specularIntensity(SpecularIntensityInfo, 1.0, 0.0, 1.0)
, _ambientIntensity(AmbientIntensityInfo, 0.2f, 0.f, 1.f)
, _diffuseIntensity(DiffuseIntensityInfo, 1.f, 0.f, 1.f)
, _specularIntensity(SpecularIntensityInfo, 1.f, 0.f, 1.f)
, _performShading(ShadingInfo, true)
, _modelTransform(ModelTransformInfo, glm::mat3(1.0))
, _modelTransform(ModelTransformInfo, glm::mat3(1.f))
, _lightSourcePropertyOwner({ "LightSources", "Light Sources" })
{
documentation::testSpecificationAndThrow(

View File

@@ -1100,28 +1100,38 @@ void OpenSpaceEngine::initializeGL() {
}
if (_configuration->isLoggingOpenGLCalls) {
using namespace glbinding;
LogLevel level = ghoul::logging::levelFromString(_configuration->logging.level);
if (level > LogLevel::Trace) {
LWARNING(
"Logging OpenGL calls is enabled, but the selected log level does "
"not include TRACE, so no OpenGL logs will be printed");
}
else {
using namespace glbinding;
setCallbackMask(CallbackMask::After | CallbackMask::ParametersAndReturnValue);
glbinding::setAfterCallback([](const glbinding::FunctionCall& call) {
std::string arguments = std::accumulate(
call.parameters.begin(),
call.parameters.end(),
std::string("("),
[](std::string a, AbstractValue* v) {
return a + ", " + v->asString();
}
);
setCallbackMask(CallbackMask::After | CallbackMask::ParametersAndReturnValue);
glbinding::setAfterCallback([](const glbinding::FunctionCall& call) {
std::string arguments = std::accumulate(
call.parameters.begin(),
call.parameters.end(),
std::string("("),
[](std::string a, AbstractValue* v) {
return a + v->asString() + ", ";
}
);
// Remove the final ", "
arguments = arguments.substr(0, arguments.size() - 2) + ")";
std::string returnValue = call.returnValue ?
" -> " + call.returnValue->asString() :
"";
std::string returnValue = call.returnValue ?
" -> " + call.returnValue->asString() :
"";
LTRACEC(
"OpenGL",
call.function->name() + arguments + returnValue
);
});
LTRACEC(
"OpenGL",
call.function->name() + std::move(arguments) + std::move(returnValue)
);
});
}
}
LDEBUG("Initializing Rendering Engine");