gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./TODO gfx/demo/pagespan.py gfx/jni/GzzGL-j...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO gfx/demo/pagespan.py gfx/jni/GzzGL-j...
Date: Tue, 17 Sep 2002 05:23:23 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/09/17 05:23:23

Modified files:
        .              : TODO 
        gfx/demo       : pagespan.py 
        gfx/jni        : GzzGL-jni.cxx 
        gfx/libos      : Os-GLX.cxx Os.hxx 
        gfx/librenderables: renderables.py 
        gzz/gfx/gl     : GLSpans.java 
        gzz/media/impl : PageImageScroll.java 

Log message:
        Now, a demo showing several pages together. Needed to drop resolution :(

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.108&tr2=1.109&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/pagespan.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libos/Os-GLX.cxx.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libos/Os.hxx.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.36&tr2=1.37&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLSpans.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/media/impl/PageImageScroll.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -c gzz/TODO:1.108 gzz/TODO:1.109
*** gzz/TODO:1.108      Tue Sep 17 01:48:39 2002
--- gzz/TODO    Tue Sep 17 05:23:22 2002
***************
*** 108,113 ****
--- 108,115 ----
          required.
        - Buoy placement
            - implement in Java, test
+       - redesign mosaics to save memory and allow more internal
+         formats
      anybody:
        - performance enhancements:
            - different internalformats for TexRects
***************
*** 142,147 ****
--- 144,150 ----
        + mediaserver - what demo?
        + fillet implementation handling all connections from a node
          simultaneously.
+     
  
  0.8alpha5: saving, loading etc. with mediaserver useful; tests
      jvk:
Index: gzz/gfx/demo/pagespan.py
diff -c gzz/gfx/demo/pagespan.py:1.2 gzz/gfx/demo/pagespan.py:1.3
*** gzz/gfx/demo/pagespan.py:1.2        Tue Sep 17 02:52:33 2002
--- gzz/gfx/demo/pagespan.py    Tue Sep 17 05:23:23 2002
***************
*** 7,26 ****
  pages = gzz.media.impl.PageImageScroll(None, gzz.mediaserver.Mediaserver.Id(
      
"0000000008000000E9573F43E00004CB42D4BEFEBAA27C20403F7D57693141B9E4D9A46329AC9C"))
  
  class PageScene:
      def __init__(self):
!       r = self.r = GLSpans.getRect(pages.getCurrent())
!       self.q = partialquad(r.x0, r.y0, r.x1, r.y1, texid=r.texId)
!       self.xs = [300,600,1000]
      def key(self, key):
        if key == 'z':
            rotatelist(self.xs)
      def scene(self, vs):
        putnoc(vs, background((0.3,0.5,0.4)))
  
!       vs.put(self.q, "Q", 10, 100, 100, 
!           self.xs[0], 
!           self.xs[0] * self.r.h / self.r.w)
  
  
  
--- 7,57 ----
  pages = gzz.media.impl.PageImageScroll(None, gzz.mediaserver.Mediaserver.Id(
      
"0000000008000000E9573F43E00004CB42D4BEFEBAA27C20403F7D57693141B9E4D9A46329AC9C"))
  
+ texincant = """
+ TexParameter TEXTURE_2D TEXTURE_WRAP_S CLAMP
+ TexParameter TEXTURE_2D TEXTURE_WRAP_T CLAMP
+ TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
+ TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
+ TexParameter TEXTURE_2D GENERATE_MIPMAP_SGIS TRUE
+ TexParameter TEXTURE_2D TEXTURE_BASE_LEVEL 0
+ """
+ 
  class PageScene:
      def __init__(self):
!       p = pages.getCurrent()
!       r = []
!       q = []
!       # for i in range(0,p.length()):
!       for i in range(0,p.length()):
!           curp = p.subSpan(i,i+1)
!           r.append( GLSpans.getRect(curp) )
!           print r[-1].texId
!           print r[-1].x1
!           print r[-1].y1
!           q.append( partialquad(r[-1].x0, r[-1].y0, r[-1].x1, r[-1].y1, 
texid=r[-1].texId) )
!       self.xs = [300,600,1000, 3000, 10000]
!       self.q = q
!       self.r = r
      def key(self, key):
        if key == 'z':
            rotatelist(self.xs)
      def scene(self, vs):
        putnoc(vs, background((0.3,0.5,0.4)))
  
!       coord = 300
!       putnoc(vs, getDListNocoords("""
!           Enable TEXTURE_2D
!       """))
!       for i in range(0, len(self.q)):
!           putnoc(vs, getDListNocoords(
!               "BindTexture TEXTURE_2D %s\n"%(self.r[i].texId) +
!               texincant +
!               "\nBindTexture TEXTURE_2D 0\n"
!               ))
!           vs.put(self.q[i], "Q"+str(i), 10, coord-self.xs[0]/2, 
coord-self.xs[0]/2, 
!               self.xs[0], 
!               self.xs[0] * self.r[i].h / self.r[i].w)
!           coord += 100
  
  
  
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -c gzz/gfx/jni/GzzGL-jni.cxx:1.18 gzz/gfx/jni/GzzGL-jni.cxx:1.19
*** gzz/gfx/jni/GzzGL-jni.cxx:1.18      Tue Sep 17 02:52:34 2002
--- gzz/gfx/jni/GzzGL-jni.cxx   Tue Sep 17 05:23:23 2002
***************
*** 388,393 ****
--- 388,420 ----
      return ret;
  }
  
+ JNIEXPORT void JNICALL Java_gzz_gfx_gl_GZZGL_impl_1Texture_1loadNull2D
+   (JNIEnv *env, jclass, jint id, jint level, jstring internalFormat_s,
+     jint w, jint h, jint border, jstring format_s, jstring type_s) {
+     int internalFormat = tokenFromJstring(env, internalFormat_s);
+     int format = tokenFromJstring(env, format_s);
+     int type = tokenFromJstring(env, type_s);
+ 
+     glBindTexture(GL_TEXTURE_2D, id);
+     // Null = just set size and texture format. 
+     glTexImage2D(GL_TEXTURE_2D, 
+               level, internalFormat, w, h, border, format, type, NULL);
+     glBindTexture(GL_TEXTURE_2D, 0);
+     GLERR
+   }
+ 
+ JNIEXPORT void JNICALL Java_gzz_gfx_gl_GZZGL_impl_1Texture_1loadSubImage
+   (JNIEnv *env, jclass, jint id, jint level, jint imageId, jint xoffs, jint 
yoffs) {
+ 
+     glBindTexture(GL_TEXTURE_2D, id);
+     glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
+ 
+     Image *img = images.get(imageId);
+     img->loadIntoTexture(level, xoffs, yoffs);
+     glBindTexture(GL_TEXTURE_2D, 0);
+     GLERR
+ }
+ 
  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GZZGL_impl_1Texture_1shade
    (JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp, 
        jstring internalFormat,
Index: gzz/gfx/libos/Os-GLX.cxx
diff -c gzz/gfx/libos/Os-GLX.cxx:1.9 gzz/gfx/libos/Os-GLX.cxx:1.10
*** gzz/gfx/libos/Os-GLX.cxx:1.9        Fri Sep 13 07:48:31 2002
--- gzz/gfx/libos/Os-GLX.cxx    Tue Sep 17 05:23:23 2002
***************
*** 87,92 ****
--- 87,98 ----
                tile.loadImage(r);
            }
        }
+       void loadIntoTexture(GLint level, GLint xoffset, GLint yoffset) {
+           r.setGLPixelModes();
+           glTexSubImage2D(GL_TEXTURE_2D, level, xoffset, yoffset,
+                   w, h, r.getGLFormat(), r.getGLType(), r.getPointer()
+                   );
+       }
      };
  
      struct LXWindow;
Index: gzz/gfx/libos/Os.hxx
diff -c gzz/gfx/libos/Os.hxx:1.7 gzz/gfx/libos/Os.hxx:1.8
*** gzz/gfx/libos/Os.hxx:1.7    Fri Sep 13 07:48:31 2002
--- gzz/gfx/libos/Os.hxx        Tue Sep 17 05:23:23 2002
***************
*** 47,52 ****
--- 47,57 ----
         */
        virtual void loadInto(Mosaic::MosaicTile &tile, 
                int x, int y, int w, int h) = 0;
+       /** Load this image into the current texture_2D.
+        */
+         virtual void loadIntoTexture(GLint level, GLint xoffset,
+                                       GLint yoffset) = 0;
+ 
         //  virtual void loadInto(Gummi::Tex::Id id,
      //            int tx, int ty, int tw, int th,
      //            int x, int y, int w, int h) = 0;
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.36 
gzz/gfx/librenderables/renderables.py:1.37
*** gzz/gfx/librenderables/renderables.py:1.36  Tue Sep 17 04:04:52 2002
--- gzz/gfx/librenderables/renderables.py       Tue Sep 17 05:23:23 2002
***************
*** 1355,1360 ****
--- 1355,1369 ----
                return impl_Texture_shade(getId(), w, h, d, comps, 
internalFormat, format,
                    shaderName, params);
            }
+           public void loadNull2D(int level, 
+                           String internalFormat, int w, int h, 
+                           int border, String format, String type) {
+               impl_Texture_loadNull2D(getId(), 
+                           level, internalFormat, w, h, border, format, type);
+           }
+           public void loadSubImage(int level, Image img, int xoffs, int 
yoffs) {
+               impl_Texture_loadSubImage(getId(), level, img.getId(), xoffs, 
yoffs);
+           }
        }
        static public Texture createTexture() { 
            return new Texture(impl_createTexture());
***************
*** 1364,1369 ****
--- 1373,1384 ----
        static private native int impl_Texture_shade(int id, int w, int h, int 
d, int comps, 
                    String internalFormat, String format,
                    String shaderName, String[] params);
+ 
+       static private native void impl_Texture_loadNull2D(int id, int level, 
+                           String internalFormat, int w, int h, 
+                           int border, String format, String type) ;
+       static private native void impl_Texture_loadSubImage(int id,
+           int level, int imgid, int xoffs, int yoffs) ;
  
      //--------- VertexProgramNV
        /** A vertex program object.
Index: gzz/gzz/gfx/gl/GLSpans.java
diff -c gzz/gzz/gfx/gl/GLSpans.java:1.3 gzz/gzz/gfx/gl/GLSpans.java:1.4
*** gzz/gzz/gfx/gl/GLSpans.java:1.3     Tue Sep 17 02:52:34 2002
--- gzz/gzz/gfx/gl/GLSpans.java Tue Sep 17 05:23:23 2002
***************
*** 18,25 ****
--- 18,31 ----
        public int texId;
        public float x0, y0, x1, y1;
        /** Width and height in points.
+        * Useful for aspect ratio and absolute scaling.
         */
        public float w, h;
+       double getTexCoord(int ind, double c) {
+           double c0 = (ind == 1 ? y0 : x0);
+           double c1 = (ind == 1 ? y1 : x1);
+           return c0 + (c1-c0)*c;
+       }
      };
      static HashMap pages = new HashMap();
  
***************
*** 28,38 ****
            GZZGL.Image img = GZZGL.createImage(file);
            this.w = img.getSize(0);
            this.h = img.getSize(1);
!           this.rect = GZZGL.createTexRect(img);
        }
!       GZZGL.TexRect rect;
!       int w;
!       int h;
      }
  
      /** Return a Rect containing the first page of the
--- 34,59 ----
            GZZGL.Image img = GZZGL.createImage(file);
            this.w = img.getSize(0);
            this.h = img.getSize(1);
!           int overw = 1; while(overw < w) overw *= 2;
!           int overh = 1; while(overh < h) overh *= 2;
!           tex = GZZGL.createTexture();
!           tex.loadNull2D(0, "R3_G3_B2", overw, overh, 0, "RGB", "FLOAT");
!           tex.loadSubImage(0, img, 0, 0);
!           // tex.shade(overw, overh, 0, 1, "LUMINANCE4", "LUMINANCE", 
"noise", new String[] {});
!           rect = new Rect();
!           rect.texId = tex.getTexId();
!           rect.x0 = 0;
!           rect.y0 = 0;
!           rect.x1 = w / (float)overw;
!           rect.y1 = h / (float)overh;
!           img = null;
!           System.gc(); // GC the image, it's big.
        }
!       GZZGL.Texture tex; // Need to save this so it won't get GC'ed.
!       Rect rect;
!       /** Width and height in pixels of the loaded image.
!        */
!       int w, h;
      }
  
      /** Return a Rect containing the first page of the
***************
*** 53,59 ****
  
            LoadedTexRect rect = getImage(file);
            r = new Rect();
!           r.texId = rect.rect.getTexId();
            r.x0 = (float)rect.rect.getTexCoord(0, resmult * p.x / rect.w);
            r.x1 = (float)rect.rect.getTexCoord(0, resmult * (p.x+d.width) / 
rect.w);
            r.y0 = (float)rect.rect.getTexCoord(1, resmult * p.y / rect.h);
--- 74,80 ----
  
            LoadedTexRect rect = getImage(file);
            r = new Rect();
!           r.texId = rect.rect.texId;
            r.x0 = (float)rect.rect.getTexCoord(0, resmult * p.x / rect.w);
            r.x1 = (float)rect.rect.getTexCoord(0, resmult * (p.x+d.width) / 
rect.w);
            r.y0 = (float)rect.rect.getTexCoord(1, resmult * p.y / rect.h);
Index: gzz/gzz/media/impl/PageImageScroll.java
diff -c gzz/gzz/media/impl/PageImageScroll.java:1.6 
gzz/gzz/media/impl/PageImageScroll.java:1.7
*** gzz/gzz/media/impl/PageImageScroll.java:1.6 Tue Sep 17 02:52:34 2002
--- gzz/gzz/media/impl/PageImageScroll.java     Tue Sep 17 05:23:23 2002
***************
*** 38,51 ****
  
  public class PageImageScroll
         implements ScrollBlockManager.MediaserverScrollBlock {
! String rcsid = "$Id: PageImageScroll.java,v 1.6 2002/09/17 06:52:34 tjl Exp 
$";
      public static boolean dbg = true;
      final static void p(String s) { if(dbg) System.out.println(s); }
      final static void pa(String s) { System.out.println(s); }
  
      int WIDTH=612; // Letter size fixed, for now, in points, 1/72ths of 
inches..
      int HEIGHT=792;
!     int RESOLUTION=144;
  
      String DIR="mstmpimg/"; // XXX Non-platform-independent!
  
--- 38,51 ----
  
  public class PageImageScroll
         implements ScrollBlockManager.MediaserverScrollBlock {
! String rcsid = "$Id: PageImageScroll.java,v 1.7 2002/09/17 09:23:23 tjl Exp 
$";
      public static boolean dbg = true;
      final static void p(String s) { if(dbg) System.out.println(s); }
      final static void pa(String s) { System.out.println(s); }
  
      int WIDTH=612; // Letter size fixed, for now, in points, 1/72ths of 
inches..
      int HEIGHT=792;
!     int RESOLUTION=72; // sigh
  
      String DIR="mstmpimg/"; // XXX Non-platform-independent!
  




reply via email to

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