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

KGLLib

renderer.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 <renderer.h>
00019 
00020 #include "texture.h"
00021 #include "program.h"
00022 
00023 #include <QtDebug>
00024 
00025 
00026 namespace KGLLib
00027 {
00028 
00029 Renderer::Renderer()
00030 {
00031     mDefaultTextureFilter = GL_LINEAR_MIPMAP_LINEAR;
00032     mDefaultTextureWrapMode = GL_CLAMP;
00033     mAutoDebugOutput = false;
00034 }
00035 
00036 Renderer::~Renderer()
00037 {
00038 }
00039 
00040 bool Renderer::init()
00041 {
00042     return true;
00043 }
00044 
00045 bool Renderer::bindTexture(const TextureBase* tex)
00046 {
00047     glBindTexture(tex->glTarget(), tex->glId());
00048     return checkGLError("Renderer::bindTexture(" + tex->debugString() + ")");
00049 }
00050 
00051 bool Renderer::unbindTexture(const TextureBase* tex)
00052 {
00053     glBindTexture(tex->glTarget(), 0);
00054     return checkGLError("Renderer::unbindTexture(" + tex->debugString() + ")");
00055 }
00056 bool Renderer::enableTexture(const TextureBase* tex)
00057 {
00058     glEnable(tex->glTarget());
00059     return checkGLError("Renderer::enableTexture(" + tex->debugString() + ")");
00060 }
00061 
00062 bool Renderer::disableTexture(const TextureBase* tex)
00063 {
00064     glDisable(tex->glTarget());
00065     return checkGLError("Renderer::disableTexture(" + tex->debugString() + ")");
00066 }
00067 
00068 bool Renderer::bindProgram(const Program* prog)
00069 {
00070     if (prog) {
00071         glUseProgram(prog->glId());
00072         return checkGLError("Renderer::bindProgram()");
00073     } else {
00074         glUseProgram(0);
00075         return checkGLError("Renderer::bindProgram(0)");
00076     }
00077 }
00078 
00079 void Renderer::setDefaultTextureFilter(GLenum filter)
00080 {
00081     mDefaultTextureFilter = filter;
00082 }
00083 
00084 void Renderer::setDefaultTextureWrapMode(GLenum mode)
00085 {
00086     mDefaultTextureWrapMode = mode;
00087 }
00088 
00089 void Renderer::setAutoDebugOutput(bool output)
00090 {
00091     mAutoDebugOutput = output;
00092 }
00093 
00094 
00095 }
00096 

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