fenfire-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ff-cvs] libvob ./rules.mk include/vob/glerr.hxx include...


From: Tuomas J. Lukka
Subject: [ff-cvs] libvob ./rules.mk include/vob/glerr.hxx include...
Date: Fri, 10 Oct 2003 09:52:39 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Tuomas J. Lukka <address@hidden>        03/10/10 09:52:30

Modified files:
        .              : rules.mk 
        include/vob    : glerr.hxx 
        include/vob/jni: Strings.hxx 
        include/vob/paper: Paper.hxx 
        include/vob/util: ImageLoader.hxx 
        include/vob/vobs: Paper.hxx Pixel.hxx Texture.hxx Trivial.hxx 
        org/nongnu/libvob/buoy: BuoyManager.java 
        org/nongnu/libvob/buoy/impl: FocusWithBuoysManager.java 
                                     FocusWithBuoysManager.test 
        org/nongnu/libvob/gl: GL.java MipzipFile.java MipzipLoader.java 
                              Paper.java 
        src/jni        : FTFont.cxx Image.cxx Main.cxx Makefile 
                         Paper.cxx QuadFont.cxx Render.cxx vobjnidef.hxx 
        src/main       : Makefile Renderer.cxx 
        src/paper      : Paper.cxx 
        src/util       : ImageLoader.cxx 
        vob/demo/aniso : probe1.py 
        vob/demo/mouse : mousemenu.py 
Added files:
        bench/gl       : texturemove.py 
        org/nongnu/libvob/gl/virtualtexture: IndirectMipzipManager.java 
                                             
NonDeletingIndirectMipzipManager.java 
                                             VirtualTexture.java 
                                             
nondeletingindirectmipzipmanager.test 
        testdata       : modularspace.mipzip modularspace.png 

Log message:
        Arch sync

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/rules.mk.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/bench/gl/texturemove.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/glerr.hxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Strings.hxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/paper/Paper.hxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/util/ImageLoader.hxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Paper.hxx.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Pixel.hxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Texture.hxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Trivial.hxx.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/buoy/BuoyManager.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.test.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/GL.java.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/MipzipFile.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/MipzipLoader.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/Paper.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/virtualtexture/IndirectMipzipManager.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/virtualtexture/NonDeletingIndirectMipzipManager.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/virtualtexture/VirtualTexture.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/virtualtexture/nondeletingindirectmipzipmanager.test?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/FTFont.cxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Image.cxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Main.cxx.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Makefile.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Paper.cxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/QuadFont.cxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Render.cxx.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/vobjnidef.hxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/main/Makefile.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/main/Renderer.cxx.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/paper/Paper.cxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/util/ImageLoader.cxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/testdata/modularspace.mipzip?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/testdata/modularspace.png?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/aniso/probe1.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/demo/mouse/mousemenu.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: libvob/include/vob/glerr.hxx
diff -u libvob/include/vob/glerr.hxx:1.2 libvob/include/vob/glerr.hxx:1.3
--- libvob/include/vob/glerr.hxx:1.2    Wed Jun 11 13:41:55 2003
+++ libvob/include/vob/glerr.hxx        Fri Oct 10 09:52:19 2003
@@ -28,10 +28,23 @@
 
 #include <GL/glu.h>
 
-#define GLERR { int er = glGetError(); if(er != GL_NO_ERROR) \
+namespace Vob {
+    extern int vobglErrorVariable;
+}
+
+/** Show a GL error, if one has occurred. Requires semicolon,
+ * allows more stream output to error stream.
+ * Example use:
+ * <pre>
+ *    glFoo(...);
+ *    GLERR << localVariable << " " << localVariable2;
+ *    glBar(...);
+ *    GLERR;
+ * </pre>
+ */
+#define GLERR if((vobglErrorVariable = glGetError()) != GL_NO_ERROR) \
                    cout << "===== OPENGL ERROR "<<__FILE__<<" "<<__LINE__ \
-                       <<"  "<<gluErrorString(er)<<"\n"; \
-           }
+                       <<"  "<<gluErrorString(vobglErrorVariable)<<"\n"
 
 
 #define STKS { if(dbg) {int sa, sm; glGetIntegerv(GL_ATTRIB_STACK_DEPTH, &sa); 
\
Index: libvob/include/vob/jni/Strings.hxx
diff -u libvob/include/vob/jni/Strings.hxx:1.2 
libvob/include/vob/jni/Strings.hxx:1.3
--- libvob/include/vob/jni/Strings.hxx:1.2      Sun Mar 16 12:58:49 2003
+++ libvob/include/vob/jni/Strings.hxx  Fri Oct 10 09:52:20 2003
@@ -27,6 +27,7 @@
 #include <jni.h>
 #include <string>
 #include <GL/gl.h>
+#include <vob/Types.hxx>
 
 namespace Vob {
 
Index: libvob/include/vob/paper/Paper.hxx
diff -u libvob/include/vob/paper/Paper.hxx:1.1 
libvob/include/vob/paper/Paper.hxx:1.2
--- libvob/include/vob/paper/Paper.hxx:1.1      Wed Mar 26 08:15:03 2003
+++ libvob/include/vob/paper/Paper.hxx  Fri Oct 10 09:52:20 2003
@@ -41,7 +41,9 @@
 #include "callgl.hxx"
 #include "callgl_objects.hxx"
 
-#include "vob/Vec23.hxx"
+#include <vob/Vec23.hxx>
+
+#include <vob/IndirectTexture.hxx>
 
 namespace Vob {
 
@@ -57,11 +59,14 @@
      */
     class LightParam {
     public:
-      /** Paper coordinate system basis vectors and origin in object 
coordinates.
+      /** Paper coordinate system basis vectors and origin in object 
+       * coordinates.
        * Paper coordinates x, y, (and z) are mapped to 
        * object position (orig + x e0 + y e1 + z e2).
-       * For the eye-linear TexGens, the basis and origin vectors are 
transformed
-       * to eye coordinates using the modelview matrix in effect at the time 
the 
+       * For the eye-linear TexGens, the basis and origin vectors 
+       * are transformed
+       * to eye coordinates using the modelview matrix in effect 
+       * at the time the 
        * TexGen::setUp method is called. 
        * Thus, after setup, the user can switch to a different coordinate
        * system for drawing the paper vertices.
@@ -96,7 +101,10 @@
     class BlendColorSetup : public LightSetup {
     public:
       virtual void setUp(LightParam *param) {
-       glBlendColor(param->color[0], param->color[1], param->color[2], 
param->color[3]);
+       glBlendColor(param->color[0], 
+                    param->color[1], 
+                    param->color[2], 
+                    param->color[3]);
       }
     };
 
@@ -126,7 +134,9 @@
     float tex_mat[16];
     
   public:
-    /** Pointer to current translation matrix used in texcoords_explicit(). */
+    /** Pointer to current translation matrix used in 
+     * texcoords_explicit(). 
+     */
     const float *explicit_mat;
       
     /** Creates a new TexGen.
@@ -227,13 +237,25 @@
      * unless it's  already loaded.
      */
     void loadVP();
+
+    /** Call setupcode and indirect texture binds.
+     */
+    void independentSetup();
+    /** Call teardown and indirect texture binds.
+     */
+    void independentTeardown();
     
   public:
     /** The code to call before beginning to render the pass. */
     CallGLCode setupcode;
     /** The code to call after rendering the pass. */
     CallGLCode teardowncode;
+
     
+    /** The indirect textures to be bound for this pass.
+     */
+    vector<shared_ptr<IndirectTextureBind> > indirectTextureBinds;
+
     /** The TexGen objects for the different texture units. */
     vector<shared_ptr<TexGen> > texgen;
     /** The non-texgen light setup routines. */
@@ -248,7 +270,7 @@
 
     /** Calls teardowncode. 
      */
-    void tearDown_texgen () { teardowncode(); }
+    void tearDown_texgen () { independentTeardown(); }
 
     /*** Vertex program version of the rendering interface. */
     /** Calls setupcode, texgen and setup for the texture.
@@ -287,7 +309,7 @@
 
     /** Calls teardowncode.
      */
-    void tearDown_explicit () { teardowncode(); }
+    void tearDown_explicit () { independentTeardown(); }
 
     /** Explicit version of the PaperPass texcoords.
      */
Index: libvob/include/vob/util/ImageLoader.hxx
diff -u libvob/include/vob/util/ImageLoader.hxx:1.3 
libvob/include/vob/util/ImageLoader.hxx:1.4
--- libvob/include/vob/util/ImageLoader.hxx:1.3 Sun Sep 28 09:02:17 2003
+++ libvob/include/vob/util/ImageLoader.hxx     Fri Oct 10 09:52:21 2003
@@ -70,7 +70,7 @@
        vector<GLuint> data;
     public:
        RGBARaster(int w, int h, vector<GLuint> &data0) :
-           width(w), height(h), data(data) {
+           width(w), height(h), data(data0) {
        }
        int getWidth() { return width; }
        int getHeight() { return height; }
@@ -88,6 +88,7 @@
        GLenum getGLType() {
            return GL_UNSIGNED_BYTE;
        }
+       const vector<GLuint> &getData() { return data; }
        void *getPointer() {
            return &(data[0]);
        }
Index: libvob/include/vob/vobs/Paper.hxx
diff -u libvob/include/vob/vobs/Paper.hxx:1.17 
libvob/include/vob/vobs/Paper.hxx:1.18
--- libvob/include/vob/vobs/Paper.hxx:1.17      Mon Aug  4 03:57:56 2003
+++ libvob/include/vob/vobs/Paper.hxx   Fri Oct 10 09:52:22 2003
@@ -236,7 +236,7 @@
 
 
     template<class T> void render(const T &coords) const {
-       GLERR
+       GLERR;
 
        using namespace PaperPriv;
        Verts verts(coords);
@@ -280,7 +280,7 @@
            verts.startT2V3Operation();
 
            for(Paper::Paper::iterator it = paper->begin(); it != paper->end(); 
++it) {
-               GLERR
+               GLERR;
                (*it).setUp_VP(&lightParam);
                triangler.draw();
                (*it).tearDown_VP();
@@ -291,7 +291,7 @@
            // Only vertex position comes from here
            verts.startV3Operation();
            for(Paper::Paper::iterator it = paper->begin(); it != paper->end(); 
++it) {
-               GLERR
+               GLERR;
                (*it).setUp_explicit(&lightParam);
 
                glBegin(GL_TRIANGLES);
@@ -316,7 +316,7 @@
 
        }
 
-       GLERR
+       GLERR;
        
        
     }
@@ -353,7 +353,7 @@
            // object -> paper/window
            const Transform &coords2inv = coords2.getInverse();
 
-           GLERR
+           GLERR;
 
 
            ZPt paperorigin, paperx, papery;
@@ -394,7 +394,7 @@
                    y1 << " " <<
                    "\\n"
                    ;
-           GLERR
+           GLERR;
 
 
            int dice;
@@ -482,18 +482,18 @@
                for(Paper::Paper::iterator it = paper->begin(); it != 
paper->end(); ++it) {
 
                     DBG(dbg_paperquad) << "Pass\\n";
-                    GLERR
+                    GLERR;
                     (*it).setUp_VP(&lightParam);
                     
                     DBG(dbg_paperquad) << "Going to multidraw\\n";
-                    GLERR
+                    GLERR;
                     glMultiDrawElementsEXT(GL_QUAD_STRIP, counts,
                        GL_UNSIGNED_INT, (const GLvoid **)indps, dice-1);
                     DBG(dbg_paperquad) << "Teardown\\n";
-                    GLERR
+                    GLERR;
                     (*it).tearDown_VP();
                 
-                    GLERR
+                    GLERR;
                     DBG(dbg_paperquad) << "Pass over\\n";
 
                }
@@ -503,11 +503,11 @@
                for(Paper::Paper::iterator it = paper->begin(); it != 
paper->end(); ++it) {
 
                     DBG(dbg_paperquad) << "Pass\\n";
-                    GLERR
+                    GLERR;
                     (*it).setUp_explicit(&lightParam);
                     
                     DBG(dbg_paperquad) << "Going to set texcoords explicit\\n";
-                    GLERR
+                    GLERR;
 
 
                     for(int ix = 0; ix<dice-1; ix++) {
@@ -532,17 +532,17 @@
 
 
                     DBG(dbg_paperquad) << "Teardown\\n";
-                    GLERR
+                    GLERR;
                     (*it).tearDown_explicit();
                 
-                    GLERR
+                    GLERR;
                     DBG(dbg_paperquad) << "Pass over\\n";
                 }
            }
 
            DBG(dbg_paperquad) << "Passes over\\n";
 
-           GLERR
+           GLERR;
 
             delete [] vertices;
             delete [] indices;
@@ -579,7 +579,7 @@
     template<class T> void render(const T &coords1, const T &coords2) const {
            const int flags = this->flags;
 
-           GLERR
+           GLERR;
 
            Paper::LightParam lightParam;
 
@@ -599,7 +599,7 @@
                    lightParam.e2 << " " <<
                    "\\n"
                    ;
-           GLERR
+           GLERR;
 
 
            int dice;
@@ -684,18 +684,18 @@
                for(Paper::Paper::iterator it = paper->begin(); it != 
paper->end(); ++it) {
 
                     DBG(dbg_paperquad) << "Pass\\n";
-                    GLERR
+                    GLERR;
                     (*it).setUp_VP(&lightParam);
                     
                     DBG(dbg_paperquad) << "Going to multidraw\\n";
-                    GLERR
+                    GLERR;
                     glMultiDrawElementsEXT(GL_QUAD_STRIP, counts,
                        GL_UNSIGNED_INT, (const GLvoid **)indps, dice-1);
                     DBG(dbg_paperquad) << "Teardown\\n";
-                    GLERR
+                    GLERR;
                     (*it).tearDown_VP();
                 
-                    GLERR
+                    GLERR;
                     DBG(dbg_paperquad) << "Pass over\\n";
 
                }
@@ -705,11 +705,11 @@
                for(Paper::Paper::iterator it = paper->begin(); it != 
paper->end(); ++it) {
 
                     DBG(dbg_paperquad) << "Pass\\n";
-                    GLERR
+                    GLERR;
                     (*it).setUp_explicit(&lightParam);
                     
                     DBG(dbg_paperquad) << "Going to set texcoords explicit\\n";
-                    GLERR
+                    GLERR;
 
 
                     for(int ix = 0; ix<dice-1; ix++) {
@@ -734,17 +734,17 @@
 
 
                     DBG(dbg_paperquad) << "Teardown\\n";
-                    GLERR
+                    GLERR;
                     (*it).tearDown_explicit();
                 
-                    GLERR
+                    GLERR;
                     DBG(dbg_paperquad) << "Pass over\\n";
                 }
            }
 
            DBG(dbg_paperquad) << "Passes over\\n";
 
-           GLERR
+           GLERR;
 
             delete [] vertices;
             delete [] indices;
@@ -760,7 +760,11 @@
 
 
 
-
+/** A vob that's useful for demoing papers.
+ * Not for real use.
+ * Doesn't set up paper properly.
+ * Should probably be done mostly in .py code.
+ */
 class BasisPaperQuad {
 public:
     enum { NTrans = 2 };
Index: libvob/include/vob/vobs/Pixel.hxx
diff -u libvob/include/vob/vobs/Pixel.hxx:1.4 
libvob/include/vob/vobs/Pixel.hxx:1.5
--- libvob/include/vob/vobs/Pixel.hxx:1.4       Mon Jun 30 03:22:52 2003
+++ libvob/include/vob/vobs/Pixel.hxx   Fri Oct 10 09:52:22 2003
@@ -63,7 +63,7 @@
        ZPt p = t.transform(ZPt(0,0,0));
        glRasterPos3f(p.x, p.y, p.z);
        glDrawPixels(w, h, format, type, bytes);
-       GLERR
+       GLERR;
        glPopClientAttrib();
        glPopAttrib();
     }
@@ -93,7 +93,7 @@
        glGetFloatv(GL_CURRENT_RASTER_POSITION, ras);
 
        glReadPixels((int)ras[0], (int)ras[1]-h, w, h, format, type, bytes);
-       GLERR
+       GLERR;
        glPopClientAttrib();
        glPopAttrib();
     }
@@ -120,7 +120,7 @@
        glRasterPos3f(p.x, p.y, p.z);
 
        glCopyPixels((int)ras[0], (int)ras[1]-h, w, h, type);
-       GLERR
+       GLERR;
     }
 };
 VOB_DEFINED(CopyPixels);
Index: libvob/include/vob/vobs/Texture.hxx
diff -u libvob/include/vob/vobs/Texture.hxx:1.4 
libvob/include/vob/vobs/Texture.hxx:1.5
--- libvob/include/vob/vobs/Texture.hxx:1.4     Sun Jun 29 04:13:15 2003
+++ libvob/include/vob/vobs/Texture.hxx Fri Oct 10 09:52:22 2003
@@ -71,7 +71,7 @@
        glCopyTexSubImage2D(target, level, x, y, 
                    (int)ras[0], (int)ras[1] - h,
                w, h);
-       GLERR
+       GLERR;
     }
 
 };
@@ -92,7 +92,7 @@
        f(target, level, x, y, w, h, format, type, pixels);
     }
     void render() const {
-       GLERR
+       GLERR;
        glPushAttrib(GL_PIXEL_MODE_BIT);
        glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
        glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
@@ -102,7 +102,7 @@
 
        glPopClientAttrib();
        glPopAttrib();
-       GLERR
+       GLERR;
     }
 
 };
Index: libvob/include/vob/vobs/Trivial.hxx
diff -u libvob/include/vob/vobs/Trivial.hxx:1.20 
libvob/include/vob/vobs/Trivial.hxx:1.21
--- libvob/include/vob/vobs/Trivial.hxx:1.20    Wed Aug 13 09:16:23 2003
+++ libvob/include/vob/vobs/Trivial.hxx Fri Oct 10 09:52:22 2003
@@ -136,7 +136,7 @@
     void render() const {
        GLERR;
        glCallList(no.get());
-       GLERR;
+       GLERR << "After calling list "<<no.get()<<"\n";
     }
 };
 
@@ -163,7 +163,7 @@
            t.dump(std::cout);
        }
        glPopMatrix();
-       GLERR;
+       GLERR << "After coorded calling list "<<no.get()<<"\n";
     }
 };
 VOB_DEFINED(CallListCoorded);
@@ -197,7 +197,7 @@
            t.dump(std::cout);
        }
        glPopMatrix();
-       GLERR;
+       GLERR << "After boxcoorded calling list "<<no.get()<<"\n";
     }
 };
 VOB_DEFINED(CallListBoxCoorded);
@@ -299,6 +299,39 @@
 
 
 VOB_DEFINED(TransTest);
+
+
+/** A Vob to draw a selection with 3 'selection modes'. 
+ * 2nd coordinate system is used to select the current mode.
+ * The mode is represented by a vob. These 3 possibile 'selection mode'
+ * vobs are set in parameters. 
+ * <p>
+ * Modes(2nd cs square size width): 
+ *    <=1 normal, 
+ *    <= 2 pre selection and 
+ *    other is post selection.
+ */
+struct SelectVob {
+    enum { NTrans = 2 };
+
+    Vob1 * normal,
+         * preSelect,
+         * postSelect;
+
+    template<class F> void params(F &f) {
+      f(normal, preSelect, postSelect);
+    }
+
+    template<class T> void render(const T &t0, const T &t1) const {
+        Pt box = t1.getSqSize();
+       //std::cout << "Size of box: " << box.x << "\n";
+       if (box.x <= 1)      normal->render1(t0);
+       else if (box.x <= 2) preSelect->render1(t0);
+       else                 postSelect->render1(t0);
+    }
+  
+};
+VOB_DEFINED(SelectVob);
 
 }}
 
Index: libvob/org/nongnu/libvob/buoy/BuoyManager.java
diff -u libvob/org/nongnu/libvob/buoy/BuoyManager.java:1.1 
libvob/org/nongnu/libvob/buoy/BuoyManager.java:1.2
--- libvob/org/nongnu/libvob/buoy/BuoyManager.java:1.1  Fri Sep  5 09:02:09 2003
+++ libvob/org/nongnu/libvob/buoy/BuoyManager.java      Fri Oct 10 09:52:22 2003
@@ -1,32 +1,82 @@
 // (c): Matti J. Katila
 
+
 package org.nongnu.libvob.buoy;
 import org.nongnu.libvob.VobScene;
 
-
-/** The manager for buoys and focus view ports.
+/** An interface for managing the buoy links, focus main node and 
+ * the construction of base coordinate systems related to buoy view.
+ * Basicly the manager constructs activated coordinate systems 
+ * for focus, main node, and for every buoy links. 
+ * <p>
+ * The information of buoys, i.e. buoy anchor, node type etc.,
+ * are needed afterwards when user clicks any of the buoys to 
+ * perform an action.
  */
-public interface BuoyManager {
+public interface BuoyManager extends BuoyLinkListener {
 
-    /** Folow the buoy link that is given. 
-     * BuoyManager implementation should interpolate 
-     * the old buoy to main view port and 
-     * old main view port to new buoy.
+    /** Represantion of anchor object rendered with some node type.
+     * Buoy implementation should be memory efficient
+     * and this implies that it's not clear that reference of buoy, 
+     * which you asked from BuoyManager, is same after new draw is done.
      */
-    void followLink(Buoy buoy);
+    public interface Buoy {
+
+       /** Get the node type of this buoy.
+        */
+       BuoyViewNodeType getNodeType();
+
+       /** Get the link identification which is 
+        * used in interpolations. The identification must be unique 
+        * to get proper interpolation.
+        */
+       Object getLinkId();
+
+
+       /** Get the anchor inside of this buoy. 
+        * The anchor is the object which was the reason to render this buoy.
+        */
+       Object getBuoyAnchor();
+
 
+       /** Get the coordinate system of this buoy.
+        * The cs is given and activated by BuoyManager and the node type
+        * of this Buoy renders into it.
+        */
+       int getBuoyCS();
 
-    /** Draw the focus view port and buoys around it.
+       /** Get the direction of this buoy. If direction > 0 
+        * buoy is on the rigth side, else the buoy is on the left side.
+        */
+       int getDirection();
+    }
+
+
+    /** Moves the focus to given buoy with interpolation from old buoy to new 
focus.
+     * If the Buoy is not from this BuoyManager an error is thrown.
+     * The old focus view port should be interpolated to new buoy.
+     */
+    void moveFocusTo(Buoy buoy);
+
+    /** Draw the focus main node. While rendering BuoyViewMainNode 
+     * BuoyManager get buoys with LinkListener's call back 
+     * interface which it implements. The buoys must not be rendered
+     * while call back linking but after every link, because 
+     * main node might render into stenciled buffer.
      * @param into The coordinate system where the focus is drawn.
      */
-    void drawScene(VobScene vs, int into);
+    void draw(VobScene vs, int into);
 
-    /** Returns the main node view.
+    /** Returns the focused main node.
      */
-    BuoyViewMainNode getViewMainNode();
+    BuoyViewMainNode getMainNode();
 
-    /** Return the buoy if it's associated with this manager 
-     * by given coordinate system, otherwise returns null.
+    /** Return the buoy found by coordinate system.
+     * To found the buoy which is clicked, ask activated
+     * coordinate system from VobScene. If coordinate system
+     * is not constructed in this BuoyManager, null is returned.
      */
     Buoy getBuoy(int cs);
+
 }
+
Index: libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.java
diff -u libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.java:1.1 
libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.java:1.2
--- libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.java:1.1   Fri Sep 
 5 09:04:30 2003
+++ libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.java       Fri Oct 
10 09:52:23 2003
@@ -12,8 +12,7 @@
 
 /** The traditional buoymanager with single focus view port.
  */
-public class FocusWithBuoysManager 
-    implements BuoyLinkListener, BuoyManager {
+public class FocusWithBuoysManager implements BuoyManager {
     static public boolean dbg = false;
     static private void p(String s) { 
System.out.println("FocusWithBuoysManager:: "+s); }
 
@@ -38,7 +37,7 @@
 
 
     // implement
-    public BuoyViewMainNode getViewMainNode() { return mainNode; }
+    public BuoyViewMainNode getMainNode() { return mainNode; }
     private BuoyViewMainNode mainNode;
     private BuoyViewConnector[] connectors;
     private BuoyGeometryConfiguration geometryConf;
@@ -54,7 +53,9 @@
 
     private Map cs = new HashMap();
     // implement
-    public Buoy getBuoy(int cs) { return (Buoy)this.cs.get(""+cs); }
+    public BuoyManager.Buoy getBuoy(int cs) { 
+       return (BuoyManager.Buoy)this.cs.get(""+cs); 
+    }
 
     // All buoy link calls are collected in this list.
     private List linkCalls = new ArrayList();
@@ -76,8 +77,10 @@
     private List links = null;
     private int mainVP_CS = -1;
     // implement
-    public void drawScene(VobScene vs, int mainBoxInto) {
+    public void draw(VobScene vs, int mainBoxInto) {
        if (dbg) p("start drawing");
+       // first take care of clearing and setting things up.
+       buoyInd = 0;
        cs.clear();
        linkCalls.clear();
 
@@ -182,7 +185,7 @@
        int otherAnchorCS = otherNode.renderBuoy(vs, into, width, 
              height, linkId, otherAnchor, null);
        if (dbg) p("linkR: render the buoy..");
-       cs.put(""+into, new Buoy(otherNode, linkId, otherAnchor, into, dir));
+       cs.put(""+into, getNewBuoy(otherNode, linkId, otherAnchor, into, dir));
 
        if (anchorCS >= 0)
            vs.map.put(lineConnector, vs.unitSqCS(anchorCS, "UN"), 
@@ -199,12 +202,63 @@
     }
 
     // implement
-    public void followLink(Buoy buoy) {
-       animationCsBuoyToMain = buoy.buoyCS;
-       animationMainVPtoBuoy = buoy.linkId;
-       mainNode = buoy.buoyNode.createMainNode(buoy.linkId, buoy.buoyAnchor);
+    public void moveFocusTo(BuoyManager.Buoy buoy) {
+       animationCsBuoyToMain = buoy.getBuoyCS();
+       animationMainVPtoBuoy = buoy.getLinkId();
+       mainNode = buoy.getNodeType()
+           .createMainNode(buoy.getLinkId(), buoy.getBuoyAnchor());
     }
 
 
+
+    private int buoyInd = 0, buoyInc = 5;
+    private BuoyManager.Buoy [] buoys = new BuoyManager.Buoy[5];
+    private BuoyManager.Buoy getNewBuoy(BuoyViewNodeType nodeType, 
+                                       Object linkId, Object anchor, 
+                                       int buoyCS, int direction) 
+    {
+       // take care if we ran out of array size
+       if (buoyInd >= buoys.length) {
+           BuoyManager.Buoy [] newArray = 
+               new BuoyManager.Buoy[buoys.length + buoyInc];
+           System.arraycopy(buoys, 0, newArray, 0, buoys.length);
+           // is this efficient for memory?
+           for (int i=0; i<buoys.length; i++) buoys[i] = null;
+           buoys = newArray;
+       }
+       
+       if (buoys[buoyInd] == null)
+           buoys[buoyInd] = new BuoyImpl();
+       BuoyManager.Buoy buoy =
+           ((BuoyImpl)buoys[buoyInd]).set(nodeType, linkId, anchor, 
+                                          buoyCS, direction);
+       buoyInd += 1;
+       return buoy;
+    }
+       
+
+
+    class BuoyImpl implements BuoyManager.Buoy {
+       BuoyViewNodeType nodeType = null;
+       Object linkId = null, anchor = null;
+       int cs = -1, direction = 0;
+       
+       BuoyManager.Buoy set(BuoyViewNodeType nodeType, Object linkId, 
+               Object anchor, int buoyCS, int direction) {
+           this.nodeType = nodeType;
+           this.linkId = linkId;
+           this.anchor = anchor;
+           this.cs = buoyCS;
+           this.direction = direction;
+           return this;
+       }
+
+       // implement
+       public BuoyViewNodeType getNodeType() { return nodeType; }
+       public Object getLinkId() { return linkId; }
+       public Object getBuoyAnchor() { return anchor; }
+       public int getBuoyCS() { return cs; }
+       public int getDirection() { return direction; }
+    }
 
 }
Index: libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.test
diff -u libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.test:1.1 
libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.test:1.2
--- libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.test:1.1   Fri Sep 
 5 09:04:30 2003
+++ libvob/org/nongnu/libvob/buoy/impl/FocusWithBuoysManager.test       Fri Oct 
10 09:52:23 2003
@@ -115,13 +115,13 @@
 
     manager = vob.buoy.impl.FocusWithBuoysManager(MainNode(), 
[Connector(buoyOldCS, buoyNewCS)], Configuration())
     manager.dbg = 1
-    manager.drawScene(vsOld, mainOldCS)
+    manager.draw(vsOld, mainOldCS)
     buoy = manager.getBuoy(buoyOldCS)
     assert buoy != None
     
-    manager.followLink(buoy)
+    manager.moveFocusTo(buoy)
     
-    manager.drawScene(vsNew, mainNewCS)
+    manager.draw(vsNew, mainNewCS)
     assert len(matcher.keymaps) == 2
 
     
Index: libvob/org/nongnu/libvob/gl/GL.java
diff -u libvob/org/nongnu/libvob/gl/GL.java:1.25 
libvob/org/nongnu/libvob/gl/GL.java:1.26
--- libvob/org/nongnu/libvob/gl/GL.java:1.25    Sun Sep 28 09:02:17 2003
+++ libvob/org/nongnu/libvob/gl/GL.java Fri Oct 10 09:52:23 2003
@@ -69,7 +69,7 @@
        }
     }
 
-    /** ATI drivers for the R300 family still have some serious bugs.
+    /** ATI Linux drivers for the R300 family still have some serious bugs.
      * We have workarounds for some in place; this flag
      * will enable them.
      * <p>
@@ -364,6 +364,7 @@
         * @param dimno The dimension (0=x, 1=y) to get.
         */
        public int getSize(int dimNo) { return getImageSize(getId(), dimNo); }
+       public int getPixel(int offset) { return getImagePixel(getId(), 
offset); }
        public Dimension getSize() {
            return new Dimension( getSize(0), getSize(1) );
        }
@@ -385,6 +386,7 @@
     static private native int createImageImpl(String filename);
     static private native void deleteImage(int i);
     static private native int getImageSize(int id, int dimNo);
+    static private native int getImagePixel(int id, int offset);
 
 
 //--------- Texture
@@ -392,7 +394,12 @@
      * Here, id == directly the texture id.
      */
     static public class Texture extends NonRenderableJavaObject {
+       /** Whether the destruction of this texture object
+        * should cause the underlying implementation texture
+        * object to be deleted.
+        */
        boolean delReal;
+
        /** Create a texture object whose GL texture will not be deleted
         * upon the deletion of the Java object.
         */
@@ -432,7 +439,13 @@
        /** Call glGetCompressedTexImage.
         */
        public byte[] getCompressedTexImage(int lod) {
-           return impl_Texture_getCompressedTexImage(getId(), lod);
+           return impl_Texture_getCompressedTexImage(getId(), lod, null);
+       }
+
+       /** Call glGetCompressedTexImage, with an array for the data.
+        */
+       public byte[] getCompressedTexImage(int lod, byte[] prearr) {
+           return impl_Texture_getCompressedTexImage(getId(), lod, prearr);
        }
 
        public void getTexImage(int lod, String format, String type,
@@ -447,9 +460,22 @@
        public void compressedTexImage(int level, 
                    String internalFormat, int width, int height, 
                        int border, byte[] data) {
+           compressedTexImage(level, internalFormat, width, height,
+                   border, data.length, data);
+       }
+       public void compressedTexImage(int level, 
+                   String internalFormat, int width, int height, 
+                       int border, int size, byte[] data) {
            impl_Texture_compressedTexImage(getId(), 
                    level, internalFormat, width, height,
-                       border, data);
+                       border, size, data);
+       }
+
+       public void compressedTexSubImage2D(int level,
+                   int xoffs, int yoffs, int width, int height,
+                   String format, int size, byte[] data) {
+           impl_Texture_compressedTexSubImage2D(getId(),
+                   level, xoffs, yoffs, width, height, format, size, data);
        }
 
        /** Call glTexImage2D.
@@ -566,12 +592,70 @@
                    String target, int level,
                    String internalFormat, int x, int y,
                    int w, int h, int border) ;
-    static private native byte[] impl_Texture_getCompressedTexImage(int id, 
int lod);
+    static private native byte[] impl_Texture_getCompressedTexImage(int id, 
int lod, byte[] preArray);
     static private native void impl_Texture_compressedTexImage(int id, int 
level, String internalFormat,
-                   int width, int height, int border, byte[] data);
+                   int width, int height, int border, int size, byte[] data);
+    static private native void impl_Texture_compressedTexSubImage2D(int id, 
int level,
+                   int xoffs, int yoffs, int width, int height, String format, 
int size, byte[] data);
     static private native void impl_Texture_getTexImage(int id, 
                    int lod, String format, String type, byte[] array) ;
 
+// -------- IndirectTexture
+
+    /** An indirect texture object. Like a pointer: can be set to 
+     * point to any given real GL.Texture object.
+     * This object exists because it's apparently unhealthy to allocate and
+     * deallocate lots of textures in some OpenGL implementations, and we need
+     * a fixed set of textures that we keep switching with each other.
+     * On the implementation side, the value zero is used for a non-bound
+     * indirect texture.
+     */
+    static public class IndirectTexture extends NonRenderableJavaObject {
+       /** The real texture this indirect texture points to.
+        * May be null.
+        * This value is mirrored on the C++ side.
+        */
+       private GL.Texture texture;
+
+       private IndirectTexture(int id, GL.Texture texture) {
+           super(id);
+           setTexture(texture);
+       }
+       protected void deleteObj() { 
+           impl_IndirectTexture_delete(getId()); 
+       }
+
+       /** Set the texture this indirect texture should point to.
+        */
+       public void setTexture(GL.Texture texture) {
+           this.texture = texture;
+           impl_IndirectTexture_setTexture(getId(), 
+                       texture == null ? 0 : texture.getTexId());
+       }
+       /** Get the texture this indirect texture currently points to.
+        */
+       public GL.Texture getTexture() {
+           return texture;
+       }
+
+       public int getIndirectTextureId() {
+           return getId();
+       }
+
+    }
+
+    static public IndirectTexture createIndirectTexture() {
+       return createIndirectTexture(null);
+    }
+    static public IndirectTexture createIndirectTexture(Texture initialValue) {
+       return new IndirectTexture(impl_IndirectTexture_create(),
+                                   initialValue);
+    }
+
+    static private native int impl_IndirectTexture_create();
+    static private native int impl_IndirectTexture_setTexture(int id, int 
texid);
+    static private native int impl_IndirectTexture_delete(int id);
+
 // -------- FTFont
     /** A freetype font.
      * Not directly renderable - see GLFont for that.
@@ -763,6 +847,8 @@
     /** An OpenGL display list.
      */
     static public class DisplayList extends NonRenderableJavaObject{
+       private ArrayList depends;
+
        private DisplayList(int id) {
            super(id);
        }
@@ -791,6 +877,22 @@
        /** Call the display list in the default context.
         */
        public void call() { GL.impl_DisplayList_call0(getId()); }
+
+       /** Get the display list ID.
+        * For use, e.g., in nesting display lists.
+        * Note that you must ensure no GC will occur.
+        * Calling addDepend is recommended.
+        */
+       public int getDisplayListID() { return getId(); }
+
+       /** Add a dependency.
+        * Adds an object that mustn't get garbage collected
+        * before this one.
+        */
+       public void addDepend(Object o) {
+           if(depends == null) depends = new ArrayList();
+           depends.add(o);
+       }
     }
 
     /** Create a new, empty display list.
Index: libvob/org/nongnu/libvob/gl/MipzipFile.java
diff -u libvob/org/nongnu/libvob/gl/MipzipFile.java:1.1 
libvob/org/nongnu/libvob/gl/MipzipFile.java:1.2
--- libvob/org/nongnu/libvob/gl/MipzipFile.java:1.1     Mon Oct  6 04:50:38 2003
+++ libvob/org/nongnu/libvob/gl/MipzipFile.java Fri Oct 10 09:52:23 2003
@@ -60,12 +60,18 @@
      */
     private final File file;
 
-    /** The sizes of the mipmap levels.
+    /** The dimensions of the mipmap levels.
      * The length of this array is the number of levels in the file.
      */
-    Dimension[] levelSizes;
+    Dimension[] levelDimensions;
+
+    /** The physical sizes (in bytes) of the mipmap levels.
+     * This is the size needed after zip decompression.
+     */
+    int[] levelSizes;
 
     /** The texture format stored in the file.
+     * Interned string, can be compared with "==".
      */
     private final String texFormat;
 
@@ -102,7 +108,7 @@
            }
            ZipEntry e = zipFile.getEntry("texformat");
            if(e == null) throw new IOException("Invalid format: no texformat 
in mipzip");
-           this.texFormat = e.getComment();
+           this.texFormat = e.getComment().intern();
            this.compressedFormat = texFormat.indexOf("COMPRESS") != -1;
 
            e = zipFile.getEntry("origsize");
@@ -131,9 +137,15 @@
                l.add(new Dimension(w, h));
 
            }
-           levelSizes = (Dimension[])l.toArray(new Dimension[l.size()]);
-           if( levelSizes[levelSizes.length-1].width != 1 ||
-               levelSizes[levelSizes.length-1].height != 1 ) {
+           levelDimensions = (Dimension[])l.toArray(new Dimension[l.size()]);
+           levelSizes = new int[levelDimensions.length];
+           for(int i=0; i<levelDimensions.length; i++) {
+               e = zipFile.getEntry(""+i);
+               levelSizes[i] = (int)e.getSize();
+           }
+
+           if( levelDimensions[levelDimensions.length-1].width != 1 ||
+               levelDimensions[levelDimensions.length-1].height != 1 ) {
                throw new IOException("Not all levels there!");
            }
            closeZipFile();
@@ -148,6 +160,7 @@
 
     /** Get the texture format as a GL string, without the GL_ prefix.
      * For example, "COMPRESSED_RGB_S3TC_DXT1_EXT'
+     * Returns an interned string for fast comparisons.
      */
     public String getTexFormat() {
        return texFormat;
@@ -156,13 +169,19 @@
     /** Get the number of mipmap levels in the file.
      */
     public int getNLevels() {
-       return levelSizes.length;
+       return levelDimensions.length;
     }
 
-    /** Get the size of the given mipmap level.
+    /** Get the texel dimensions of the given mipmap level.
      */
-    public Dimension getLevelSize(int level) {
-       return (Dimension)(levelSizes[level].clone());
+    public Dimension getLevelDimension(int level) {
+       return (Dimension)(levelDimensions[level].clone());
+    }
+
+    /** Get the physical size (in bytes) of a given mipmap level.
+     */
+    public int getLevelSize(int level) { 
+       return levelSizes[level];
     }
 
     /** Get the width of the original image inside 
@@ -182,11 +201,25 @@
      * This class does NOT cache any of the binary data.
      */
     synchronized public byte[] getLevelData(int level) throws IOException {
+       return getLevelData(level, null);
+    }
+    /** Get the binary data from the given level into the given array.
+     * This class does NOT cache any of the binary data.
+     * If the array is too small or null, return a new, larger array
+     * (analogous to java.util.Collection.toArray).
+     */
+    synchronized public byte[] getLevelData(int level, byte[] into) 
+                                       throws IOException {
        String name = ""+level;
        synchronized(zlibLock) {
            openZipFile();
            ZipEntry e = zipFile.getEntry(name);
-           byte[] loadedData = new byte[(int)e.getSize()];
+           int size = getLevelSize(level);
+           byte[] loadedData;
+           if(into != null || into.length >= size)
+               loadedData = into;
+           else
+               loadedData = new byte[(int)e.getSize()];
            InputStream i = zipFile.getInputStream(e);
            int offs = 0;
            while(offs < loadedData.length) {
Index: libvob/org/nongnu/libvob/gl/MipzipLoader.java
diff -u libvob/org/nongnu/libvob/gl/MipzipLoader.java:1.10 
libvob/org/nongnu/libvob/gl/MipzipLoader.java:1.11
--- libvob/org/nongnu/libvob/gl/MipzipLoader.java:1.10  Mon Oct  6 04:50:38 2003
+++ libvob/org/nongnu/libvob/gl/MipzipLoader.java       Fri Oct 10 09:52:23 2003
@@ -132,7 +132,7 @@
                pa("TexImage "+MipzipLoader.this+" "+level+
                        " "+state);
            if(state != STATE_DATALOADED) return;
-           Dimension size = mipzipFile.getLevelSize(level);
+           Dimension size = mipzipFile.getLevelDimension(level);
            if(mipzipFile.getIsCompressedFormat())
                tex.compressedTexImage(level, mipzipFile.getTexFormat(),
                            size.width, size.height, 0,
@@ -376,7 +376,7 @@
     public int getMemory(int level) {
        if(level < 0) level = 0;
        if(level > levels.length-1) level = levels.length-1;
-       Dimension size = mipzipFile.getLevelSize(level);
+       Dimension size = mipzipFile.getLevelDimension(level);
        int bytesForLevel = size.width * size.height * bitsPerTexel / 8;
        int totalBytes = (bytesForLevel * 4) / 3;
        return totalBytes;
@@ -401,7 +401,7 @@
      * shown in 100x100 square (or like).
      */
     public int getLevelForQuality(float quality) {
-       Dimension size = mipzipFile.getLevelSize(0);
+       Dimension size = mipzipFile.getLevelDimension(0);
        int maxdim = Math.max(size.height, size.width);
        float ratio = maxdim / quality;
        int l = (int)(Math.log(ratio) / LG2);
@@ -418,7 +418,7 @@
     }
 
     public float getQuality(int level) {
-       Dimension size = mipzipFile.getLevelSize(level);
+       Dimension size = mipzipFile.getLevelDimension(level);
        int maxdim = Math.max(size.height, 
                                size.width);
        return maxdim;
@@ -433,8 +433,8 @@
     /** Get the size, in texels, of a texture level.
      * The return value must not be altered!
      */
-    public Dimension getLevelSize(int level) {
-       return mipzipFile.getLevelSize(level);
+    public Dimension getLevelDimension(int level) {
+       return mipzipFile.getLevelDimension(level);
     }
 
     /** Create a new MipzipLoader for the given mipzip file.
Index: libvob/org/nongnu/libvob/gl/Paper.java
diff -u libvob/org/nongnu/libvob/gl/Paper.java:1.6 
libvob/org/nongnu/libvob/gl/Paper.java:1.7
--- libvob/org/nongnu/libvob/gl/Paper.java:1.6  Tue Aug 19 03:57:10 2003
+++ libvob/org/nongnu/libvob/gl/Paper.java      Fri Oct 10 09:52:23 2003
@@ -29,6 +29,17 @@
 import java.util.ArrayList;
 
 /** The interface to the paper library.
+ * This interface is relatively low-level, just to make it 
+ * map as easily as possible to the JNI code.
+ * For all array-type things (X), there are the methods setNX, getNX
+ * and also some (possibly different, for using derived 
+ * classes) putX methods.
+ * <p>
+ * For example, the paper contains the Passes array, 
+ * so there are the methods getNPasses() and setNPasses(int i).
+ * The passes are all of the same type so they are automatically
+ * added as empties - getPass gives the Pass object to use 
+ * to place stuff into the pass.
  */
 public class Paper implements GLDeletable {
     public static boolean dbg = true;
@@ -54,10 +65,21 @@
        depends.add(o); 
     }
 
+    /** A class representing a single rendering pass
+     * of a paper.
+     * A pass contains the two CallGL codes Setupcode and Teardowncode,
+     * and the following arrays:
+     * IndirectTextureBinds, TexGens, LightSetups.
+     *
+     */
     public class Pass {
        private int index;
        private Pass(int index) { this.index = index; }
 
+       public void setNIndirectTextureBinds(int n) { 
impl_Pass_setNIndirectTextureBinds(c_id, index, n); }
+
+       public int getNIndirectTextureBinds() { return 
impl_Pass_getNIndirectTextureBinds(c_id, index); }
+
        public int getNTexGens() { return impl_Pass_getNTexGens(c_id, index); }
        public void setNTexGens(int n) { impl_Pass_setNTexGens(c_id, index, n); 
}
 
@@ -80,6 +102,30 @@
            impl_Pass_putEmbossTexGen(c_id, index, ind, matrix, eps);
        }
 
+       /** Put an instruction to bind an indirect texture
+        * for this pass.
+        * The GL.IndirectTexture object is automatically
+        * added to the depends array.
+        * @param ind The index of the indirect texture bind instruction to put
+        * @param activeTexture The GL token string (without the GL_ prefix)
+        *                      for which texture to call glActiveTextureARB
+        *                      for. E.g. "TEXTURE1_ARB"
+        * @param textureTarget The GL token string (w.o. GL_) for
+        *                      which texture target to bind.
+        *                      E.g. "TEXTURE_3D"
+        * @param indirectTexture The indirect texture to bind.
+        */
+       public void putIndirectTextureBind(int ind, 
+                       String activeTexture, String textureTarget,
+                       GL.IndirectTexture indirectTexture) {
+           if(ind < 0 || ind >= getNIndirectTextureBinds())
+               throw new ArrayIndexOutOfBoundsException(ind);
+           addDepend(indirectTexture);
+           impl_Pass_putIndirectTextureBind(c_id, index, ind,
+                           activeTexture, textureTarget,
+                           indirectTexture.getIndirectTextureId());
+       }
+
        /** Add an object on whose C++ representation this paper
         * depends. For instance, if one of the setup codes uses
         * a texture id of a given GL.Texture object, then that
@@ -144,4 +190,8 @@
 
     static private native void impl_Pass_putNormalTexGen(int pid, int pass, 
int ind, float[] matrix) ;
     static private native void impl_Pass_putEmbossTexGen(int pid, int pass, 
int ind, float[] matrix, float eps) ;
+
+    static private native void impl_Pass_setNIndirectTextureBinds(int pid, int 
pass, int n);
+    static private native int impl_Pass_getNIndirectTextureBinds(int pid, int 
pass);
+    static private native void impl_Pass_putIndirectTextureBind(int pid, int 
pass, int ind, String activeTexture, String textureTarget, int 
indirectTextureId);
 } 
Index: libvob/rules.mk
diff -u libvob/rules.mk:1.25 libvob/rules.mk:1.26
--- libvob/rules.mk:1.25        Sun Jun 29 05:25:24 2003
+++ libvob/rules.mk     Fri Oct 10 09:52:17 2003
@@ -25,9 +25,12 @@
 
 OPTIMIZE = -O0
 
+# DBG=-g
+DBG=
+
 CPPFLAGS = -I../include -I../../libvob-depends -I../../include $(EXTRAINCLUDE) 
-I../../callgl/include -I../../../callgl/include 
-I../../callgl/include/glwrapper -I../../../callgl/include/glwrapper 
-I../../glmosaictext/include -I../../../glmosaictext/include 
-I/usr/include/freetype2 `gdk-pixbuf-config --cflags`
-CXXFLAGS = -g -Wall $(OPTIMIZE) $(CPPFLAGS)  
-CCFLAGS = -g -Wall
+CXXFLAGS = $(DBG) -Wall $(OPTIMIZE) $(CPPFLAGS)  
+CCFLAGS = $(DBG) -Wall
 
 SHARED = -shared
 
Index: libvob/src/jni/FTFont.cxx
diff -u libvob/src/jni/FTFont.cxx:1.1 libvob/src/jni/FTFont.cxx:1.2
--- libvob/src/jni/FTFont.cxx:1.1       Sun Sep 28 09:02:17 2003
+++ libvob/src/jni/FTFont.cxx   Fri Oct 10 09:52:25 2003
@@ -49,7 +49,7 @@
 
 DBGVAR(dbg_ftfont, "JNI.ftfont");
 
-void gotError(JNIEnv *env, int error) {
+static void gotError(JNIEnv *env, int error) {
     cerr << "Font error: "<<error<<"\n";
     jclass errclass = env->FindClass("java/lang/Error");
     env->ThrowNew(errclass, "Font error!");
Index: libvob/src/jni/Image.cxx
diff -u libvob/src/jni/Image.cxx:1.2 libvob/src/jni/Image.cxx:1.3
--- libvob/src/jni/Image.cxx:1.2        Mon Aug  4 03:57:56 2003
+++ libvob/src/jni/Image.cxx    Fri Oct 10 09:52:25 2003
@@ -44,6 +44,12 @@
 
     ObjectStorer<ImageLoader::RGBARaster> images("Images");
 
+static void gotError(JNIEnv *env) {
+    cerr << "Image error\n";
+    jclass errclass = env->FindClass("java/lang/Error");
+    env->ThrowNew(errclass, "Image loading error!");
+}
+
 extern "C" {
 // Image
 
@@ -51,6 +57,10 @@
   (JNIEnv *env, jclass, jstring filename) {
       std::string utf = jstr2stdstr(env, filename);
       RGBARaster *img = loadImageRGBA(utf.c_str());
+      if(img == 0) {
+         gotError(env);
+         return 0;
+      }
       return images.add(img);
   }
 
@@ -68,14 +78,22 @@
          return i->getHeight();
 }
 
+jf( jint, getImagePixel )
+(JNIEnv *, jclass, jint img, jint offset) {
+    RGBARaster *i = images[img];
+    if(offset < 0 || (unsigned)offset >= i->getData().size()) 
+       return -1;
+    return i->getData()[offset];
+}
+
 jf( void , impl_1Texture_1loadSubImage )
   (JNIEnv *env, jclass, jint id, jint level, jint imageId, jint x, jint y,
     jint xoffs, jint yoffs, jint w, jint h) {
 
     glBindTexture(GL_TEXTURE_2D, id);
-    GLERR
+    GLERR;
     glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
-    GLERR
+    GLERR;
 
     RGBARaster *img = images.get(imageId);
 
@@ -83,16 +101,16 @@
     img->setGLPixelModes();
     glPixelStorei(GL_UNPACK_SKIP_PIXELS, x);
     glPixelStorei(GL_UNPACK_SKIP_ROWS, y);
-    GLERR
+    GLERR;
     glTexSubImage2D(GL_TEXTURE_2D, level, xoffs, yoffs,
            w, h, img->getGLFormat(), img->getGLType(), img->getPointer()
            );
-    GLERR
+    GLERR;
     glPopClientAttrib();
 
-    GLERR
+    GLERR;
     glBindTexture(GL_TEXTURE_2D, 0);
-    GLERR
+    GLERR;
 }
 
 
Index: libvob/src/jni/Main.cxx
diff -u libvob/src/jni/Main.cxx:1.26 libvob/src/jni/Main.cxx:1.27
--- libvob/src/jni/Main.cxx:1.26        Sun Sep 28 09:02:17 2003
+++ libvob/src/jni/Main.cxx     Fri Oct 10 09:52:25 2003
@@ -32,7 +32,6 @@
 #include <vob/glerr.hxx>
 
 #include <vob/Texture.hxx>
-#include <vob/buildmipmaps.hxx>
 #include <vob/Debug.hxx>
 
 
@@ -56,6 +55,7 @@
 
 ObjectStorer<ByteVector> bytevectors("bytevectors");
 
+extern Texture::TextureParam textureParams(JNIEnv *env, jobjectArray params) ;
 
 ObjectStorer<Os::RenderingSurface> windows("windows");
 Os::Window *defaultWindow; // A kludge
@@ -105,6 +105,19 @@
     }
 }
 
+bool GLERR_JNI_impl(JNIEnv *env, const char *file, int line) {
+    int errorVariable = glGetError();
+    if(errorVariable != GL_NO_ERROR) {
+       cout << "===== JNI OPENGL ERROR "<<file<<" "<<line 
+           <<"  "<<gluErrorString(errorVariable)<<"\n";
+       jclass errclass = env->FindClass("java/lang/Error");
+       env->ThrowNew(errclass, "OpenGL error!");
+       
+       return true;
+    }
+    return false;
+}
+
 struct GZZJNIEventHandler : public Os::Eventhandler {
 
     jobject globalRef;
@@ -385,306 +398,6 @@
 }
 
 
-// Texture
-jf(jint, impl_1createTexture)
-  (JNIEnv *, jclass) {
-      setWindow();
-      GLuint ret;
-      glGenTextures(1, &ret);
-      DBG(dbg) << "Created texture id "<<ret<<"\n";
-      GLERR
-      releaseWindow();
-      return ret;
-}
-
-jf(void, impl_1deleteTexture)
-  (JNIEnv *, jclass, jint id) {
-      setWindow();
-      GLuint rel = id;
-      glDeleteTextures(1, &rel);
-      GLERR
-      releaseWindow();
-}
-
-bool hasGenMipmaps() {
-    static int initialized;
-    static bool hasExtension;
-    // XXX: the test should probably be done elsewhere
-    if (!initialized) {
-       hasExtension = strstr((const char *)glGetString(GL_EXTENSIONS), 
-                             "GL_SGIS_generate_mipmap") != 0;
-       initialized = true;
-    }
-    return hasExtension;
-}
-
-jf(void, impl_1Texture_1loadNull2D)
-  (JNIEnv *env, jclass, jint id, 
-     jstring target_s, jint level, jstring internalFormat_s,
-    jint w, jint h, jint border, jstring format_s, jstring type_s) {
-    int target = tokenFromJstring(env, target_s);
-    int internalFormat = tokenFromJstring(env, internalFormat_s);
-    int format = tokenFromJstring(env, format_s);
-    int type = tokenFromJstring(env, type_s);
-
-    glBindTexture(target, id);
-    // Null = just set size and texture format. 
-    glTexImage2D(target,
-               level, internalFormat, w, h, border, format, type, NULL);
-    glBindTexture(target, 0);
-    GLERR
-  }
-
-jf(void, impl_1Texture_1texImage2D)
-  (JNIEnv *env, jclass, jint id, jint level, jstring internalFormat_s,
-    jint w, jint h, jint border, jstring format_s, jstring type_s,
-    jbyteArray jdata) {
-    int internalFormat = tokenFromJstring(env, internalFormat_s);
-    int format = tokenFromJstring(env, format_s);
-    int type = tokenFromJstring(env, type_s);
-    jbyte *data = env->GetByteArrayElements(jdata, 0);
-
-    glBindTexture(GL_TEXTURE_2D, id);
-    glTexImage2D(GL_TEXTURE_2D,
-               level, internalFormat, w, h, border, format, type, data);
-    env->ReleaseByteArrayElements(jdata, data, JNI_ABORT);
-    glBindTexture(GL_TEXTURE_2D, 0);
-    GLERR
-  }
-
-
-jf(void, impl_1Texture_1texSubImage2D)
-  (JNIEnv *env, jclass, jint id, jint level, jint x, jint y,
-    jint w, jint h, jint border, jstring format_s, jstring type_s,
-    jbyteArray jdata) {
-    int format = tokenFromJstring(env, format_s);
-    int type = tokenFromJstring(env, type_s);
-    jbyte *data = env->GetByteArrayElements(jdata, 0);
-
-    glBindTexture(GL_TEXTURE_2D, id);
-
-    glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
-    glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
-    glTexSubImage2D(GL_TEXTURE_2D,
-               level, x, y, w, h, format, type, data);
-
-    glPopClientAttrib();
-
-    env->ReleaseByteArrayElements(jdata, data, JNI_ABORT);
-    glBindTexture(GL_TEXTURE_2D, 0);
-    GLERR
-  }
-
-
-jf(jbyteArray, impl_1Texture_1getCompressedTexImage)
-  (JNIEnv *env, jclass, jint id, jint lod) {
-      int size;
-      glBindTexture(GL_TEXTURE_2D, id);
-      glGetTexLevelParameteriv(GL_TEXTURE_2D, lod, 
GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &size);
-      GLERR;
-      jbyteArray arr = env->NewByteArray(size);
-      jbyte *b = env->GetByteArrayElements(arr, 0);
-      glGetCompressedTexImageARB(GL_TEXTURE_2D, lod, b);
-      env->ReleaseByteArrayElements(arr, b, 0);
-      glBindTexture(GL_TEXTURE_2D, 0);
-      GLERR;
-     return arr;
-}
-
-jf(void, impl_1Texture_1getTexImage)
- (JNIEnv *env, jclass, jint id, jint level, jstring jformat, jstring jtype,
-    jbyteArray jdata) {
-    glBindTexture(GL_TEXTURE_2D, id);
-    GLenum format = tokenFromJstring(env, jformat);
-    GLenum type = tokenFromJstring(env, jtype);
-    jbyte *b = env->GetByteArrayElements(jdata, 0);
-
-    glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
-    glPixelStorei(GL_PACK_ROW_LENGTH, 0);
-    glPixelStorei(GL_PACK_ALIGNMENT, 1);
-
-    glGetTexImage(GL_TEXTURE_2D, level, format, type, b);
-
-    glPopClientAttrib();
-
-    env->ReleaseByteArrayElements(jdata, b, 0);
-    GLERR
- }
-
-
-
-jf(void, impl_1Texture_1compressedTexImage)
- (JNIEnv *env, jclass, jint id, jint level, jstring jinternalFormat, jint 
width, jint height,
-       jint border, jbyteArray jdata) {
-     int size = env->GetArrayLength(jdata);
-     jbyte *data = env->GetByteArrayElements(jdata, 0);
-     glBindTexture(GL_TEXTURE_2D, id);
-     GLenum internalFormat = tokenFromJstring(env, jinternalFormat);
-
-     glCompressedTexImage2DARB(GL_TEXTURE_2D, level, internalFormat,
-                   width, height, border, size, data);
-     glFinish(); // Appears that NV 4191 drivers need this.
-     glBindTexture(GL_TEXTURE_2D, 0);
-     env->ReleaseByteArrayElements(jdata, data, 0);
-     GLERR;
-
-}
-
-jf(void, impl_1Texture_1downsampleInto)
-  (JNIEnv *env, jclass, jint id, jint intoid, jstring targetstr, jint level, 
jstring internalFormat, jstring transferType) 
-{
-    GLenum target = tokenFromJstring(env, targetstr);
-    GLenum intern = tokenFromJstring(env, internalFormat);
-    GLenum trans = tokenFromJstring(env, transferType);
-    glBindTexture(target, id);
-    GLint w=0,h=0;
-    // XXX Only does 2D
-    glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &w);
-    glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &h);
-
-    GLubyte *data = new GLubyte[w*h*4]; // assuming 4 components
-
-    glPixelStorei(GL_PACK_ROW_LENGTH, 0);
-    glPixelStorei(GL_PACK_ALIGNMENT, 1);
-    glGetTexImage(target, level, trans, GL_UNSIGNED_BYTE, data);
-
-
-    glBindTexture(target, intoid);
-    glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-    glTexParameteri(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
-    glTexImage2D(target, 0, intern, w, h, 0, trans, GL_UNSIGNED_BYTE,
-           data);
-
-    delete[] data;
-    glBindTexture(target, 0);
-
-
-}
-
-jf(void, impl_1Texture_1copyTexImage2D)
-    (JNIEnv *env, jclass, jint id, jint wid, jstring bufferstr,
-    jstring targetstr, jint level,
-    jstring iforstring, jint x, jint y, jint w, jint h,
-    jint border) {
-    setWindow(wid);
-    GLenum buffer = tokenFromJstring(env, bufferstr);
-    GLenum target = tokenFromJstring(env, targetstr);
-    GLenum ifor = tokenFromJstring(env, iforstring);
-    glBindTexture(target, id);
-    glReadBuffer(buffer);
-    DBG(dbg) << "Copyteximage "<<target<<" "<<level<<" "<<ifor<<" "
-           <<x<<" "<<y<<" "<<w<<" "<<h<<" "<<border<<"\n";
-    glCopyTexImage2D(target, level, ifor, x, y, w, h, border);
-    glBindTexture(target, 0);
-    GLERR
-    releaseWindow();
-}
-
-Texture::TextureParam textureParams(JNIEnv *env, jobjectArray params) {
-
-      Texture::TextureParam p;
-
-      for(int i=0; i<env->GetArrayLength(params)-1; i+=2) {
-         std::string k = jstr2stdstr(env, 
(jstring)(env->GetObjectArrayElement(params, i)));
-         std::string v = jstr2stdstr(env, 
(jstring)(env->GetObjectArrayElement(params, i+1)));
-         p.setParam(k.c_str(), v.c_str());
-      }
-
-      return p;
-}
-
-jf(jint, impl_1Texture_1shade)
-  (JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp, 
-       jstring internalFormat,
-       jstring format,
-           jstring name, jobjectArray params, jboolean shade_all_levels) {
-      setWindow();
-      DBG(dbg)<<"Shade into "<<id<<"\n";
-
-      std::string name_utf = jstr2stdstr(env, name);
-
-      Texture::Texture *s = Texture::Texture::getTexture(name_utf.c_str());
-
-      if(!s) {
-         return 0;
-      }
-
-      Texture::TextureParam p = textureParams(env, params);
-
-      float *value = new float[w * h * (d==0?1:d) * comp];
-
-      GLenum target = (d == 0) ? GL_TEXTURE_2D : GL_TEXTURE_3D;
-
-      glBindTexture(target, id);
-
-      int buildmipmaps = 0;
-
-      if (!shade_all_levels) {
-         if (hasGenMipmaps()) {
-             glTexParameteri(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
-             GLERR;
-         } else {
-             buildmipmaps = 1;
-         }
-      } 
-       
-      int level;
-      for (level = 0; ; level++) {
-         s->render(&p, w, h, (d==0?1:d), comp, value);
-
-         if (buildmipmaps) {
-             assert(d==0); // 3D buildmipmaps not implemented in libutil
-             Util::buildmipmaps(GL_TEXTURE_2D, 
-                                tokenFromJstring(env, internalFormat),
-                                w, h, 
-                                tokenFromJstring(env, format),
-                                GL_FLOAT,
-                                value);
-         } else 
-         if (d == 0)
-             glTexImage2D(GL_TEXTURE_2D, level,
-                          tokenFromJstring(env, internalFormat),
-                          w, h, 0, 
-                          tokenFromJstring(env, format),
-                          GL_FLOAT,
-                          value);
-         else
-             glTexImage3D(GL_TEXTURE_3D, level,
-                          tokenFromJstring(env, internalFormat),
-                          w, h, d, 0, 
-                          tokenFromJstring(env, format),
-                          GL_FLOAT,
-                          value);
-
-         GLERR;
-             
-         if (! (shade_all_levels && (w > 1 || h > 1 || d > 1))) break;
-         
-         w = (w + 1) >> 1;
-         h = (h + 1) >> 1;
-         d = (d + 1) >> 1;
-      } 
-      
-      if (shade_all_levels) {
-         glTexParameterf(target, GL_TEXTURE_BASE_LEVEL, 0);
-         glTexParameterf(target, GL_TEXTURE_MAX_LEVEL, level);
-      }
-
-      glBindTexture(target, 0);
-      GLERR;
-
-      delete[] value;
-      delete s;
-
-      releaseWindow();
-
-      return 1;
-}
-
-
 // OpenGL Program
 jf(jint, impl_1createProgram)
   (JNIEnv *, jclass) {
@@ -742,66 +455,6 @@
   }
 
 
-// DisplayList
-
-jf(jint, createDisplayListImpl)
-  (JNIEnv *, jclass) {
-      setWindow();
-      int l = glGenLists(1);
-      releaseWindow();
-      if(!l) {
-         cerr << "Couldn't allocate display list\n";
-         exit(25);
-      }
-      return l;
-  }
-jf(void, startCompile)
-  (JNIEnv *, jclass, jint l, jint wid) {
-      DBG(dbg) << "Start list compilation "<<l<<"\n";
-
-      setWindow(wid);
-
-      GLERR
-      glNewList(l, GL_COMPILE);
-      GLERR
-  }
-jf(void, endCompile)
-  (JNIEnv *, jclass, jint, jint wid) {
-      DBG(dbg) << "End list compilation\n";
-      GLERR
-      glEndList();
-      GLERR
-
-      releaseWindow();
-  }
-
-jf(void, compileCallGL)
-  (JNIEnv *env, jclass, jint l, jstring s) {
-      std::string utf = jstr2stdstr(env, s);
-      DBG(dbg) << "got str\n";
-      CallGL::compileGL(utf.c_str(), l);
-      DBG(dbg) << "called\n";
-  }
-
-jf(void, deleteDisplayList)
-  (JNIEnv *, jclass, jint l) {
-      DBG(dbg) << "Delete display list (XXX Might crash if contexts wrong)\n";
-      glDeleteLists(l, 1);
-      DBG(dbg) << "Deleted display list\n";
-  }
-
-jf(void, impl_1DisplayList_1call)
-  (JNIEnv *, jclass, jint l, jint w) {
-      setWindow(w);
-      glCallList(l);
-      releaseWindow();
-}
-
-jf(void, impl_1DisplayList_1call0)
-  (JNIEnv *, jclass, jint l) {
-      glCallList(l);
-}
-
 
 // ByteVector
 //
@@ -841,7 +494,7 @@
     DBG(dbg) << "set\n";
     glReadPixels(x, y, w, h, form, typ, &((*v)[0]));
     DBG(dbg) << "fin1\n";
-    GLERR
+    GLERR;
     glPopClientAttrib();
     glPopAttrib();
     releaseWindow();
@@ -864,7 +517,7 @@
     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
     glRasterPos3f(x, y, z);
     glDrawPixels(w, h, form, typ, &((*v)[0]));
-    GLERR
+    GLERR;
     glPopClientAttrib();
     glPopAttrib();
     releaseWindow();
Index: libvob/src/jni/Makefile
diff -u libvob/src/jni/Makefile:1.35 libvob/src/jni/Makefile:1.36
--- libvob/src/jni/Makefile:1.35        Sun Sep 28 09:02:18 2003
+++ libvob/src/jni/Makefile     Fri Oct 10 09:52:25 2003
@@ -5,7 +5,7 @@
 VOB_OBJS = $(VOBS:%=%.vobjniobj)
 TRANS_OBJS = $(TRANS:%=%.transjniobj)
 
-sources = TransFactory.cxx Main.cxx Strings.cxx Transform.cxx Render.cxx 
Paper.cxx Image.cxx TexAccum.cxx Arrays.cxx QuadFont.cxx FTFont.cxx
+sources = TransFactory.cxx Main.cxx Strings.cxx Transform.cxx Render.cxx 
Paper.cxx Image.cxx TexAccum.cxx Arrays.cxx QuadFont.cxx FTFont.cxx 
IndirectTexture.cxx Texture.cxx DisplayList.cxx
 
 
 
@@ -22,7 +22,7 @@
 
 TRANSOBJS=../trans/Transform.o ../trans/Coorder.o
 
-MAINOBJS=../main/Renderer.o
+MAINOBJS=../main/Renderer.o ../main/IndirectTexture.o
 
 OBJS= $(sources:%.cxx=%.o)
 
Index: libvob/src/jni/Paper.cxx
diff -u libvob/src/jni/Paper.cxx:1.3 libvob/src/jni/Paper.cxx:1.4
--- libvob/src/jni/Paper.cxx:1.3        Wed Mar 26 14:05:46 2003
+++ libvob/src/jni/Paper.cxx    Fri Oct 10 09:52:25 2003
@@ -33,7 +33,10 @@
 #include <vob/util/ObjectStorer.hxx>
 #include <vob/paper/Paper.hxx>
 
+
 #include "org_nongnu_libvob_gl_Paper.h"
+#include <vob/jni/Strings.hxx>
+#include "vobjnidef.hxx"
 
 
 using namespace Vob;
@@ -42,6 +45,8 @@
 namespace Vob {
 namespace JNI {
 
+    extern ObjectStorer<IndirectTexture> indirectTextures;
+
 using std::cout;
 
 #define GLERR { int er = glGetError(); if(er != GL_NO_ERROR) \
@@ -85,6 +90,18 @@
       papers[id]->resize(size);
 }
 
+
+jpf( jint , impl_1Pass_1getNIndirectTextureBinds)
+  (JNIEnv *, jclass, jint id, jint pass) {
+      return (*papers[id])[pass].indirectTextureBinds.size();
+}
+
+jpf( void , impl_1Pass_1setNIndirectTextureBinds)
+  (JNIEnv *, jclass, jint id, jint pass, jint size) {
+      (*papers[id])[pass].indirectTextureBinds.resize(size);
+}
+
+
 jpf( jint , impl_1Pass_1getNTexGens)
   (JNIEnv *, jclass, jint id, jint pass) {
       return (*papers[id])[pass].texgen.size();
@@ -175,6 +192,27 @@
       env->ReleaseFloatArrayElements(arr, floats, JNI_ABORT);
       
 }
+
+jpf( void , impl_1Pass_1putIndirectTextureBind)
+  (JNIEnv *env, jclass, jint id, jint pass, jint ind, 
+       jstring activeTexture, jstring textureTarget,
+       int indirectTextureId) 
+{
+    GLERR
+
+    (*papers[id])[pass].indirectTextureBinds[ind] =
+       shared_ptr<IndirectTextureBind>(
+               new IndirectTextureBind(
+                   tokenFromJstring(env, activeTexture),
+                   tokenFromJstring(env, textureTarget),
+                   indirectTextures.get(indirectTextureId)));
+
+    GLERR
+}
+
+
+
+
 
 }
 
Index: libvob/src/jni/QuadFont.cxx
diff -u libvob/src/jni/QuadFont.cxx:1.1 libvob/src/jni/QuadFont.cxx:1.2
--- libvob/src/jni/QuadFont.cxx:1.1     Sun Sep 28 09:02:18 2003
+++ libvob/src/jni/QuadFont.cxx Fri Oct 10 09:52:25 2003
@@ -36,10 +36,11 @@
 
 
 #include "org_nongnu_libvob_gl_GL.h"
-#include "vobjnidef.hxx"
 #include <vob/jni/Strings.hxx>
 
 #include <vob/text/QuadFont.hxx>
+
+#include "vobjnidef.hxx"
 
 namespace Vob {
 namespace JNI {
Index: libvob/src/jni/Render.cxx
diff -u libvob/src/jni/Render.cxx:1.6 libvob/src/jni/Render.cxx:1.7
--- libvob/src/jni/Render.cxx:1.6       Thu May 29 04:00:20 2003
+++ libvob/src/jni/Render.cxx   Fri Oct 10 09:52:25 2003
@@ -67,7 +67,7 @@
        DBG(dbg_render) << "RENDER "<<window<<" "<<numinds<<" "
                <<j_inds1<<" "<<j_pts1<<" "<<
                j_interpinds<<" "<<j_inds2<<" "<<j_pts2<<" "<<j_codes<<"\n";
-       GLERR
+       GLERR;
        DBG(dbg_render) << "1\n";
        if(standardcoords) 
           setWindow(window);
@@ -109,7 +109,7 @@
 
          Renderer::setStandardCoordinates(Vec(xywh[2], xywh[3]));
       }
-       GLERR
+       GLERR;
 
       DBG(dbg_render) << "Did stdcoords\n";
       renderer.renderScene((int *)codes, vob0s, vob1s, vob2s, vob3s, vobNs);
@@ -129,7 +129,7 @@
         env->ReleaseIntArrayElements(j_interpinds, interpinds, JNI_ABORT);
       }
       DBG(dbg_render) << "Did releasearrays\n";
-       GLERR
+       GLERR;
 
       if(standardcoords) {
          releaseWindow();
@@ -154,7 +154,7 @@
        DBG(dbg_render) << "RENDER "<<window<<" "<<" "
                <<j_inds1<<" "<<j_pts1<<" "<<
                " "<<j_codes<<"\n";
-       GLERR
+       GLERR;
        DBG(dbg_render) << "1\n";
        if(standardcoords) 
           setWindow(window);
@@ -189,7 +189,7 @@
 
          Renderer::setStandardCoordinates(Vec(xywh[2], xywh[3]));
       }
-       GLERR
+       GLERR;
 
       double t0 = getTime();
       for(int iter = 0; iter < iters; iter++) {
@@ -211,7 +211,7 @@
       env->ReleaseFloatArrayElements(j_pts1, pts1, JNI_ABORT);
 
       DBG(dbg_render) << "Did releasearrays\n";
-       GLERR
+       GLERR;
 
       if(standardcoords) {
          releaseWindow();
Index: libvob/src/jni/vobjnidef.hxx
diff -u libvob/src/jni/vobjnidef.hxx:1.4 libvob/src/jni/vobjnidef.hxx:1.5
--- libvob/src/jni/vobjnidef.hxx:1.4    Mon Jun 16 12:16:30 2003
+++ libvob/src/jni/vobjnidef.hxx        Fri Oct 10 09:52:25 2003
@@ -42,5 +42,11 @@
 */
 void javaExc(JNIEnv *env, const char *where) ;
 
+/** If an OpenGL exception has occurred, throw it to Java and return true.
+ */
+bool GLERR_JNI_impl(JNIEnv *env, const char *file, int line) ;
+
+#define GLERR_JNI(env) GLERR_JNI_impl(env, __FILE__, __LINE__)
+
 }
 }
Index: libvob/src/main/Makefile
diff -u libvob/src/main/Makefile:1.1 libvob/src/main/Makefile:1.2
--- libvob/src/main/Makefile:1.1        Wed Mar 12 08:40:28 2003
+++ libvob/src/main/Makefile    Fri Oct 10 09:52:27 2003
@@ -1,7 +1,7 @@
 
 include ../../rules.mk
 
-sources = Renderer.cxx
+sources = Renderer.cxx IndirectTexture.cxx
 
 all: $(sources:.cxx=.o) 
 
Index: libvob/src/main/Renderer.cxx
diff -u libvob/src/main/Renderer.cxx:1.15 libvob/src/main/Renderer.cxx:1.16
--- libvob/src/main/Renderer.cxx:1.15   Sun Sep 28 09:02:18 2003
+++ libvob/src/main/Renderer.cxx        Fri Oct 10 09:52:27 2003
@@ -42,6 +42,9 @@
 
 namespace Vob {
 
+    // For glerr.hxx
+    int vobglErrorVariable;
+
     namespace Vobs {
        DBGVAR(dbg_irregularquad, "IrregularQuad");
        DBGVAR(dbg_vfillets, "VFillets");
@@ -90,17 +93,17 @@
     int w = (int)wh.x;
     int h = (int)wh.y;
     glViewport(0, 0, w, h);
-    GLERR
+    GLERR;
     glMatrixMode(GL_PROJECTION);
-    GLERR
+    GLERR;
     glLoadIdentity();
-    GLERR
+    GLERR;
     glOrtho(0, w, h, 0, 10000, -10000);
-    GLERR
+    GLERR;
     glMatrixMode(GL_MODELVIEW);
-    GLERR
+    GLERR;
     glLoadIdentity();
-    GLERR
+    GLERR;
     DBG(dbg_renderer) << "stdcoords done\n";
 
 }
Index: libvob/src/paper/Paper.cxx
diff -u libvob/src/paper/Paper.cxx:1.4 libvob/src/paper/Paper.cxx:1.5
--- libvob/src/paper/Paper.cxx:1.4      Thu May  1 20:06:30 2003
+++ libvob/src/paper/Paper.cxx  Fri Oct 10 09:52:27 2003
@@ -332,9 +332,22 @@
               mat[2] * Li.x + mat[3] * Li.y, Li.z);
        glColor3f(.5 * L.x + .5, .5 * L.y + .5, .5 * L.z + .5);
       }
+
+  void PaperPass::independentSetup() {
+      setupcode();
+      for(unsigned i=0; i<indirectTextureBinds.size(); i++) {
+         indirectTextureBinds[i]->bind();
+      }
+  }
+  void PaperPass::independentTeardown() {
+      for(unsigned i=0; i<indirectTextureBinds.size(); i++) {
+         indirectTextureBinds[i]->unbind();
+      }
+      teardowncode();
+  }
   
   void PaperPass::setUp_texgen(LightParam *param) {
-    setupcode();
+    independentSetup();
     
     /* Set up TexGen for each texture unit */
     GLenum unit = GL_TEXTURE0_ARB;
@@ -374,7 +387,7 @@
   void PaperPass::setUp_VP(LightParam *param) {
     if (texgenvp.getSource().length() == 0) loadVP();
     
-    setupcode();
+    independentSetup();
     
     /* Set up VP TexGen parameters for each texture unit */
     int unit = 0;
@@ -397,14 +410,14 @@
   }
   
   void PaperPass::tearDown_VP() {
-    teardowncode();
+    independentTeardown();
 #ifdef GL_VERTEX_PROGRAM_NV
     glDisable(GL_VERTEX_PROGRAM_NV);
 #endif
   }
 
   void PaperPass::setUp_explicit(LightParam *param) {
-    setupcode();
+    independentSetup();
     
     /* Set up explicit TexGen parameters for each texture unit */
     for (vector<shared_ptr<TexGen> >::iterator it = texgen.begin(); it != 
texgen.end(); ++it) {
Index: libvob/src/util/ImageLoader.cxx
diff -u libvob/src/util/ImageLoader.cxx:1.3 libvob/src/util/ImageLoader.cxx:1.4
--- libvob/src/util/ImageLoader.cxx:1.3 Sun Sep 28 09:02:18 2003
+++ libvob/src/util/ImageLoader.cxx     Fri Oct 10 09:52:28 2003
@@ -38,13 +38,11 @@
 
     DBGVAR(dbg, "ImageLoader");
 
-    struct Problem {};
-
     /** Load an image into a raster using gdk-pixbuf.
      */
     RGBARaster *loadImageRGBA(const char *filename) {
        GdkPixbuf* pb = gdk_pixbuf_new_from_file(filename);
-       if(!pb) throw Problem();
+       if(!pb) return 0;
 
        DBG(dbg) << "NC "<<gdk_pixbuf_get_n_channels(pb)
            <<" ALP "<<gdk_pixbuf_get_has_alpha(pb)
@@ -60,8 +58,12 @@
        int w = gdk_pixbuf_get_width(pb);
        int h = gdk_pixbuf_get_height(pb);
        if(nc == 4) {
+           DBG(dbg) << "4: data resize\n";
            data.resize(w*h);
+           DBG(dbg) << "get pixels\n";
            GLuint *c = (GLuint *)gdk_pixbuf_get_pixels(pb);
+           DBG(dbg) << "pixels "<<(int)c<<"\n";
+           DBG(dbg) << "copy\n";
            copy(c, c + w * h, data.begin());
            /*
            for(int i=0; i<w*h; i++) 
@@ -69,15 +71,22 @@
            */
            DBG(dbg) << "\n";
        } else if(nc == 3) {
+           DBG(dbg) << "3: data resize\n";
            data.resize(w*h);
+           DBG(dbg) << "get pixels\n";
            GLubyte *c = (GLubyte *)gdk_pixbuf_get_pixels(pb);
+           DBG(dbg) << "pixels "<<(int)c<<"\n";
            for(int i=0; i<w*h; i++) {
                data[i] = c[i*3] + (c[i*3+1] << 8) + (c[i*3+2] << 16) + (255 << 
24);
            }
+           DBG(dbg) << "copied \n";
        } else {
-           throw Problem();
+           DBG(dbg) << "invalid \n";
+           gdk_pixbuf_unref(pb);
+           return 0;
        }
        gdk_pixbuf_unref(pb);
+       DBG(dbg) << "unrefed \n";
        return new RGBARaster(w, h, data);
     }
 }
Index: libvob/vob/demo/aniso/probe1.py
diff -u libvob/vob/demo/aniso/probe1.py:1.2 libvob/vob/demo/aniso/probe1.py:1.3
--- libvob/vob/demo/aniso/probe1.py:1.2 Mon Oct  6 04:50:38 2003
+++ libvob/vob/demo/aniso/probe1.py     Fri Oct 10 09:52:29 2003
@@ -25,37 +25,102 @@
        maxsize >> i, maxsize >> i, 0,
        "RGBA", "UNSIGNED_BYTE", ebytes)
            
-tex.setTexParameter("TEXTURE_2D", "TEXTURE_MAG_FILTER", "LINEAR")
-tex.setTexParameter("TEXTURE_2D", "TEXTURE_MIN_FILTER", "LINEAR_MIPMAP_LINEAR")
-tex.setTexParameter("TEXTURE_2D", "TEXTURE_MAX_ANISOTROPY_EXT", "20")
 
+quadlist = vob.gl.GL.createDisplayList("""
+    Begin QUADS
+    TexCoord 0 0
+    Vertex 0 0
+    TexCoord 0 1
+    Vertex 0 1
+    TexCoord 1 1
+    Vertex 1 1
+    TexCoord 1 0
+    Vertex 1 0
+    End
+""")
+quadlistId = quadlist.getDisplayListID()
+
+if 1:
+    # Use the simple distorted surrounding-square mode
+    def getSqSize(level):
+       """Get the size of the square to use in the unified visualization.
+
+       level -- mipmap level
+       """
+       if level == 0: return 2
+       else: return getSqSize(level-1) * 2 + 2
+
+    def getSqCoord(level, x):
+       """Get the relative coordinate of the square in the unified 
visualization.
+
+       level -- mipmap level
+       x -- the coordinate in the texture
+       """
+       # print "GetSqCoord",level,x
+       if level >= nlevels: return 0
+       ret = 1 + (x & 1) * getSqSize(level) + getSqCoord(level+1, x>>1)
+       # print "Ret: ",ret
+       return ret
+
+    squareLists = []
+    for level in range(0, nlevels + 1):
+       sqSize = getSqSize(level)
+       sql = []
+       for i in range(0, sqSize):
+           sqM = sqSize - 1
+           sql.append("""
+           PushMatrix
+               Translate %(i)s 0 0
+               CallList %(quadlistId)s
+               Translate 0 %(sqM)s 0
+               CallList %(quadlistId)s
+           PopMatrix
+           PushMatrix
+               Translate 0 %(i)s 0
+               CallList %(quadlistId)s
+               Translate %(sqM)s 0 0
+               CallList %(quadlistId)s
+           PopMatrix
+           """ % locals())
+       squareLists.append(GL.createDisplayList("".join(sql)))
+else:
+    # XXX unfinished use real square
+    def getSqCoord(level, x):
+       return nlevels - level + (nlevels+1)*0
 
 xoffs = 0
 list = ["""
     BindTexture TEXTURE_2D %s
 """ % tex.getTexId()]
 
+sqx = 10
+sqy = 100
+
+
 for i in range(0, nlevels + 1):
+    listId = squareLists[i].getDisplayListID()
     for x in range(0, maxsize >> i):
+       xsq = sqx + getSqCoord(i, x)
        for y in range(0, maxsize >> i):
-           xt = x * (1. / (maxsize >> i))
-           yt = y * (1. / (maxsize >> i))
+           ysq = sqy + getSqCoord(i, y)
            xm = x + xoffs
            ym = y
-           xp = xm+1
-           yp = ym+1
            list.append("""
                TexSubImage2D TEXTURE_2D  %(i)s %(x)s %(y)s 1 1 RGBA 1 1 1 1
-               Begin QUADS
-               TexCoord 0 0
-               Vertex %(xm)s %(ym)s
-               TexCoord 0 1
-               Vertex %(xm)s %(yp)s
-               TexCoord 1 1
-               Vertex %(xp)s %(yp)s
-               TexCoord 1 0
-               Vertex %(xp)s %(ym)s
-               End
+               PushMatrix
+               Translate %(xm)s %(ym)s 0
+               CallList %(quadlistId)s
+               PopMatrix
+           """ % locals())
+
+           list.append("""
+               PushMatrix
+               Translate %(xsq)s %(ysq)s 0
+               CallList %(listId)s
+               PopMatrix
+           """ % locals())
+
+           list.append("""
                TexSubImage2D TEXTURE_2D  %(i)s %(x)s %(y)s 1 1 RGBA 0.5 0.5 
0.5 0.5
            """% locals())
     xoffs += maxsize >> i
@@ -64,12 +129,18 @@
 # print "".join(list)
 
 list = getDListNocoords("".join(list))
-
+# XXX SHould adddepend to dlist but not vital
 
 
 
 class Scene:
     def __init__(self):
+       self.minfilters = [
+           "LINEAR_MIPMAP_LINEAR",
+           "LINEAR_MIPMAP_NEAREST",
+           "NEAREST_MIPMAP_LINEAR",
+           "NEAREST_MIPMAP_NEAREST",
+           ]
        self.key = KeyPresses(
             self, 
            SlideLin("ctrx", .5, .01, "x coord", "Left", "Right"),
@@ -77,6 +148,7 @@
            SlideLin("rot", 0, 1, "angle", ">", "<"),
            SlideLog("sx", .09, "x scale", "j", "k"),
            SlideLog("sy", .09, "y scale", "h", "l"),
+           ListIndex("minfilter", "minfilters", 0, "Filter type", "F", "f"),
        )
     def scene(self, vs):
        self.vs = vs
@@ -86,8 +158,15 @@
        texturerot = vs.rotateCS(texturetrans, "B", self.rot)
        texturemat = vs.scaleCS(texturerot, "C", self.sx, self.sy)
 
+       tex.setTexParameter("TEXTURE_2D", "TEXTURE_MAG_FILTER", "LINEAR")
+       tex.setTexParameter("TEXTURE_2D", "TEXTURE_MIN_FILTER", 
self.minfilters[self.minfilter])
+       tex.setTexParameter("TEXTURE_2D", "TEXTURE_MAX_ANISOTROPY_EXT", "20")
+
+       # invtexturemat = vs.invertCS(texturemat, "D")
+       print "Min: ",self.minfilters[self.minfilter]
 
        vs.put(getDListNocoords(vob.putil.nvcode.parseCombiner("""
+           PushAttrib ENABLE_BIT TEXTURE_BIT
            Enable TEXTURE_2D
            Disable BLEND
            Disable ALPHA_TEST
@@ -95,6 +174,7 @@
            TexEnv TEXTURE_ENV TEXTURE_ENV_MODE REPLACE
 
 
+
            # Strengthen by multiplying by 4
 
            Enable REGISTER_COMBINERS_NV
@@ -119,4 +199,24 @@
                texturemat)
        vs.put(list)
 
+       footprintFrame = vs.orthoCS(0, "F", 0, 500, 100, 256, 256)
+       footprintCS = vs.coords.concat(footprintFrame, texturemat)
+       vs.matcher.add(footprintCS, "FP")
+       footprintCS = vs.translateCS(footprintCS, "TRA", 0, 0, -10)
+
+       vs.put(getDListNocoords("""
+           PopAttrib
+           Disable TEXTURE_2D
+           PolygonMode FRONT_AND_BACK LINE
+       """))
+
+       vs.put(coloredQuad((0,0,0)), footprintFrame)
+       vs.put(coloredQuad((1,0,0)), footprintCS)
+
+       vs.put(getDListNocoords("""
+           PolygonMode FRONT_AND_BACK FILL
+       """))
+
+       print vs.coords.transformPoints3(footprintCS, [0,0,0, 0,1,0, 1,0,0, 
1,1,0], None)
+       
 
Index: libvob/vob/demo/mouse/mousemenu.py
diff -u libvob/vob/demo/mouse/mousemenu.py:1.1 
libvob/vob/demo/mouse/mousemenu.py:1.2
--- libvob/vob/demo/mouse/mousemenu.py:1.1      Mon Aug 25 15:48:35 2003
+++ libvob/vob/demo/mouse/mousemenu.py  Fri Oct 10 09:52:29 2003
@@ -1,10 +1,11 @@
 # (c): Matti J. Katila
 
-import vob
+import vob, jarray
 
 
 class Scene:
     def __init__(self):
+        self.vs = None
         items = [
             vob.vobs.SelectItemVob('Poromies', None),
             vob.vobs.SelectItemVob('a', None),
@@ -19,16 +20,22 @@
         if ev.getButton() == 3:
             if ev.getType() == ev.MOUSE_CLICKED:
                 self.x, self.y = ev.getX(), ev.getY()
+                self.vs = None
         else:
+            pts = jarray.zeros(3, 'f')
+            self.vs.coords.inverseTransformPoints3(self.cs, [ev.getX(), 
ev.getY(), 0.], pts)
+
+            #print 'points',pts, [ev.getX()-150, ev.getY()-150]
+            
             if ev.getType() in [ev.MOUSE_PRESSED, ev.MOUSE_DRAGGED]:
-                self.list.preSelect(ev.getX() - 150, ev.getY() - 150)
+                self.list.preSelect(self.vs, pts[0], pts[1])
             if ev.getType() in [ev.MOUSE_RELEASED, ev.MOUSE_CLICKED]:
-                self.list.postSelect(ev.getX() - 150, ev.getY() - 150)
+                self.list.postSelect(self.vs, pts[0], pts[1])
                 
                 hit = self.vs.coords.getCSAt(0, ev.getX(), ev.getY(), None)
                 if hit >= 0:
                     obj = self.vs.matcher.getKey(hit)
-                    print 'obj: ', obj
+                    print 'obj: ', obj #.getKey()
                 else:
                     print 'nothing', hit
                 
@@ -40,12 +47,14 @@
         vob.AbstractUpdateManager.chg()
 
     def scene(self, vs):
+        if self.vs != None:
+            return self.vs
         self.vs = vs
         vs.put(background((.1, .1, .9)))
         
         x, y = 150, 150
-        cs = vs.orthoBoxCS(0,'asdf', 0, x,y, 1,1, self.x-x, self.y-y)
-        vs.put(self.list, cs)
+        self.cs = vs.orthoBoxCS(0,'asdf', 0, x,y, 1,1, self.x-x, self.y-y)
+        vs.put(self.list, self.cs)
 
 
 currentScene = Scene()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]