From 5b45911856442ee7cbd451125c47fd13f21db58e Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Mon, 13 Aug 2012 23:09:30 +0200 Subject: Improved error messages Added some logging and improved error messages displayed to user --- src/graphics/opengl/gldevice.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/graphics/opengl/gldevice.cpp') diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index 3526b13..7221421 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -20,6 +20,7 @@ #include "common/config.h" #include "common/image.h" +#include "common/logger.h" #include "math/geometry.h" @@ -80,13 +81,10 @@ void Gfx::CGLDevice::DebugHook() glColor3i(0, 0, 0); } -std::string Gfx::CGLDevice::GetError() -{ - return m_error; -} - bool Gfx::CGLDevice::Create() { + GetLogger()->Info("Creating CDevice\n"); + #if defined(USE_GLEW) static bool glewInited = false; @@ -96,13 +94,13 @@ bool Gfx::CGLDevice::Create() if (glewInit() != GLEW_OK) { - m_error = "GLEW initialization failed"; + GetLogger()->Error("GLEW initialization failed\n"); return false; } if ( (! GLEW_ARB_multitexture) || (! GLEW_EXT_texture_env_combine) || (! GLEW_EXT_secondary_color) ) { - m_error = "GLEW reports required extensions not supported"; + GetLogger()->Error("GLEW reports required extensions not supported\n"); return false; } } @@ -142,6 +140,8 @@ bool Gfx::CGLDevice::Create() m_texturesEnabled = std::vector (maxTextures, false); m_textureStageParams = std::vector(maxTextures, Gfx::TextureStageParams()); + GetLogger()->Info("CDevice created successfully\n"); + return true; } @@ -385,7 +385,7 @@ Gfx::Texture Gfx::CGLDevice::CreateTexture(CImage *image, const Gfx::TextureCrea ImageData *data = image->GetData(); if (data == NULL) { - m_error = "Invalid texture data"; + GetLogger()->Error("Invalid texture data\n"); return Gfx::Texture(); // invalid texture } -- cgit v1.2.3-1-g7c22