[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/libs/kgllib/core/kgllib
From: Rivo Laks <rivolaks () hot ! ee>
Date: 2008-01-24 20:31:46
Message-ID: 1201206706.915628.15636.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 765876 by rivol:
Add and use Renderer::bindProgram()
M +3 -2 program.cpp
M +13 -1 renderer.cpp
M +5 -1 renderer.h
--- trunk/playground/libs/kgllib/core/kgllib/program.cpp #765875:765876
@@ -18,6 +18,7 @@
#include "program.h"
#include <shader.h>
+#include "renderer.h"
#include <qlist.h>
#include <qstring.h>
@@ -110,12 +111,12 @@
void Program::bind() const
{
- glUseProgram(glId());
+ renderer->bindProgram(this);
}
void Program::unbind() const
{
- glUseProgram(0);
+ renderer->bindProgram(0);
}
int Program::uniformLocation(const QString& name)
--- trunk/playground/libs/kgllib/core/kgllib/renderer.cpp #765875:765876
@@ -17,7 +17,8 @@
#include <renderer.h>
-#include <kgllib.h>
+#include "texture.h"
+#include "program.h"
#include <QtDebug>
@@ -65,6 +66,17 @@
return checkGLError("Renderer::disableTexture(" + tex->debugString() + ")");
}
+bool Renderer::bindProgram(const Program* prog)
+{
+ if (prog) {
+ glUseProgram(prog->glId());
+ return checkGLError("Renderer::bindProgram()");
+ } else {
+ glUseProgram(0);
+ return checkGLError("Renderer::bindProgram(0)");
+ }
+}
+
void Renderer::setAutoBind(bool bind)
{
mAutoBind = bind;
--- trunk/playground/libs/kgllib/core/kgllib/renderer.h #765875:765876
@@ -18,10 +18,12 @@
#ifndef KGLLIB_RENDERER_H
#define KGLLIB_RENDERER_H
-#include "texture.h"
+#include "kgllib.h"
namespace KGLLib
{
+class TextureBase;
+class Program;
class KGLLIB_EXPORT Renderer
{
@@ -36,6 +38,8 @@
virtual bool enableTexture(const TextureBase* tex);
virtual bool disableTexture(const TextureBase* tex);
+ virtual bool bindProgram(const Program* prog);
+
// TODO: maybe have setAutoBind()/autoBind() methods? If autoBind() is
// true then every texture/shader/etc operation would cause the
// corresponding object to be bind()ed automatically. Is this a good idea
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic