• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KGLLib

kgllib.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008 Rivo Laks <rivolaks@hot.ee>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either 
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public 
00015  * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #include "kgllib.h"
00019 
00020 #include "renderer.h"
00021 
00022 #include <QString>
00023 #include <QtDebug>
00024 
00025 namespace KGLLib
00026 {
00027 
00028 Renderer* renderer = 0;
00029 
00030 bool init(Renderer* r)
00031 {
00032     // Init GLEW
00033     GLenum ret = glewInit();
00034     if (ret != GLEW_NO_ERROR) {
00035         qCritical() << "GLEW init failed with code" << ret;
00036         return false;
00037     }
00038 
00039     // Init renderer
00040     renderer = r ? r : new Renderer();
00041     if (!renderer->init()) {
00042         return false;
00043     }
00044     // ...
00045     return true;
00046 }
00047 
00048 bool checkGLError(const QString& desc)
00049 {
00050     GLenum error = glGetError();
00051     if (error == GL_NO_ERROR) {
00052         return true;
00053     } else {
00054         const char* errString = (const char*)gluErrorString(error);
00055         qCritical() << qPrintable(desc) << ":" << errString;
00056         return false;
00057     }
00058 }
00059 
00060 }
00061 

KGLLib

Skip menu "KGLLib"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KGLLib
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal