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

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

SVN commit 792668 by rivol:

- Make a ctor explicit
- Add an optional textureFormat to a ctor so that e.g. FP-rendertargets can be created.

 M  +4 -4      rendertarget.cpp  
 M  +6 -4      rendertarget.h  


--- trunk/playground/libs/kgllib/extras/kgllib/rendertarget.cpp #792667:792668
@@ -43,11 +43,11 @@
     endInit();
 }
 
-RenderTarget::RenderTarget(int width, int height, bool hasDepth)
+RenderTarget::RenderTarget(int width, int height, bool hasDepth, GLint textureFormat)
 {
     // Create the color texture. Apparently this has to be done before we bind
     //  the FBO
-    Texture* color = createColorTexture(width, height);
+    Texture* color = createColorTexture(width, height, textureFormat);
 
     if (!startInit()) {
         return;
@@ -120,11 +120,11 @@
     mValid = true;
 }
 
-Texture* RenderTarget::createColorTexture(int w, int h)
+Texture* RenderTarget::createColorTexture(int w, int h, GLint textureFormat)
 {
     mOwnColorTexture = true;
     // TODO: what if NPOT textures aren't supported?
-    return new Texture(w, h);
+    return new Texture(w, h, textureFormat);
 }
 
 Texture* RenderTarget::createDepthTexture(int w, int h)
--- trunk/playground/libs/kgllib/extras/kgllib/rendertarget.h #792667:792668
@@ -32,14 +32,16 @@
      * Creates RenderTarget object for rendering onto @p color. @p color must
      *  be a valid RGBA texture.
      **/
-    RenderTarget(Texture* color);
+    explicit RenderTarget(Texture* color);
     /**
      * Creates a render target of size @p width x @p height. Internal color
-     *  texture is created and can be accessed using @ref texture().
+     *  texture is created and can be accessed using @ref texture(). The
+     *  internal format of the color texture can be specified using
+     *  @p textureFormat parameter.
      * If @p depth is true then internal depth renderbuffer is created but you
      *  will have no access to it.
      **/
-    RenderTarget(int width, int height, bool hasDepth = false);
+    RenderTarget(int width, int height, bool hasDepth = false, GLint textureFormat = GL_RGBA);
     /**
      * Creates RenderTarget object for rendering onto @p color and @p depth.
      *  If either of them is null then internal renderbuffer is created for
@@ -59,7 +61,7 @@
     static bool isSupported();
 
 protected:
-    Texture* createColorTexture(int w, int h);
+    Texture* createColorTexture(int w, int h, GLint textureFormat = GL_RGBA);
     Texture* createDepthTexture(int w, int h);
     GLuint createDepthBuffer(int w, int h);
 

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

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