[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/libs/kgllib/examples
From:       Rivo Laks <rivolaks () hot ! ee>
Date:       2008-01-27 19:44:54
Message-ID: 1201463094.282835.12147.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 767311 by rivol:

Use setErrorText() when data can't be loaded

 M  +7 -3      simpleflying/testwidget.cpp  
 M  +4 -0      spinninglogos/logos.cpp  


--- trunk/playground/libs/kgllib/examples/simpleflying/testwidget.cpp #767310:767311
@@ -107,9 +107,6 @@
 
     qDebug() << "loading qt4 tex";
     tex = new KGLLib::Texture("pilt.png");
-    if (tex->isValid()) {
-        qDebug() << "tex is valid with id" << tex->glId();
-    }
     qDebug() << "loading grass tex";
     grass = new KGLLib::Texture("grass1.jpg");
     KGLLib::checkGLError("init3");
@@ -121,9 +118,16 @@
     terrain->setTexture(grass);
     KGLLib::checkGLError("init4");
 
+    if (!tex->isValid() || !grass->isValid() || !terrain->isValid()) {
+        return setErrorText("Data couldn't be loaded");
+    }
+
     qDebug() << "loading program";
     program = new KGLLib::Program("test.vert", "test.frag");
     KGLLib::checkGLError("init5.1");
+    if (!program->isValid()) {
+        return setErrorText("Data couldn't be loaded");
+    }
     program->bind();
     program->setUniform("groundTexture", 0);
     program->setUniform("fogColor", fogcolor);
--- trunk/playground/libs/kgllib/examples/spinninglogos/logos.cpp #767310:767311
@@ -59,6 +59,10 @@
     // Load logo textures
     mKDELogoTex = new Texture("kde.png");
     mQtLogoTex = new Texture("qt.png");
+    // If either of the logos couldn't be loaded then show an error
+    if (!mKDELogoTex->isValid() || !mQtLogoTex->isValid()) {
+        return setErrorText("Data couldn't be loaded");
+    }
     // We only draw logos once, so set a GL_CLAMP wrap mode for them
     mKDELogoTex->setWrapMode(GL_CLAMP);
     mQtLogoTex->setWrapMode(GL_CLAMP);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic