Last active
December 11, 2015 10:39
-
-
Save sreich/4588750 to your computer and use it in GitHub Desktop.
GWEN assert on opengl texture file missing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From cf8542f420aa3bf0351662f20b8f2301ae134891 Mon Sep 17 00:00:00 2001 | |
From: Shaun Reich <sreich@kde.org> | |
Date: Mon, 21 Jan 2013 14:51:00 -0500 | |
Subject: [PATCH] make opengl renderer assert on non existent file | |
--- | |
gwen/Renderers/OpenGL/OpenGL.cpp | 6 ++++++ | |
1 file changed, 6 insertions(+) | |
diff --git a/gwen/Renderers/OpenGL/OpenGL.cpp b/gwen/Renderers/OpenGL/OpenGL.cpp | |
index 717897c..9643bd0 100644 | |
--- a/gwen/Renderers/OpenGL/OpenGL.cpp | |
+++ b/gwen/Renderers/OpenGL/OpenGL.cpp | |
@@ -10,6 +10,7 @@ | |
#include "GL/glew.h" | |
#include "FreeImage/FreeImage.h" | |
#include <assert.h> | |
+#include <sys/stat.h> | |
namespace Gwen | |
{ | |
@@ -177,6 +178,11 @@ namespace Gwen | |
{ | |
const wchar_t *wFileName = pTexture->name.GetUnicode().c_str(); | |
+ struct stat buf; | |
+ const int status = stat( pTexture->name.Get().c_str(), &buf); | |
+ Gwen::Debug::AssertCheck(status != -1, "Texture load failure, image does not exist"); | |
+ | |
+ | |
FREE_IMAGE_FORMAT imageFormat = FreeImage_GetFileTypeU( wFileName ); | |
if ( imageFormat == FIF_UNKNOWN ) | |
-- | |
1.8.0.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment