gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./Makefile ./TODO gfx/jni/GzzGL-jni.cxx gfx...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./Makefile ./TODO gfx/jni/GzzGL-jni.cxx gfx...
Date: Sat, 09 Nov 2002 15:19:26 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/11/09 15:19:26

Modified files:
        .              : Makefile TODO 
        gfx/jni        : GzzGL-jni.cxx 
        gfx/libcallgl  : callgl.cxx 
        gfx/librenderables: renderables.py 
        gzz/client/gl  : GLScreen.java 
        gzz/gfx/gl     : GL.java 
Added files:
        gfx/demo/opengl: imaging.py 

Log message:
        Try border drawing using an image-space algorithm.. too slow on GF4Go.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Makefile.diff?tr1=1.208&tr2=1.209&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.381&tr2=1.382&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/opengl/imaging.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/jni/GzzGL-jni.cxx.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcallgl/callgl.cxx.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.133&tr2=1.134&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/gl/GLScreen.java.diff?tr1=1.38&tr2=1.39&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GL.java.diff?tr1=1.20&tr2=1.21&r1=text&r2=text

Patches:
Index: gzz/Makefile
diff -u gzz/Makefile:1.208 gzz/Makefile:1.209
--- gzz/Makefile:1.208  Sat Nov  9 10:07:08 2002
+++ gzz/Makefile        Sat Nov  9 15:19:25 2002
@@ -287,7 +287,7 @@
        gcj-3.0 --main=(mainclass) -o gzigzag $(SRC)
 
 # doc: pegs javadoc documl docxx
-doc: javadoc documl docxx
+doc: pegs javadoc documl docxx
 
 javadoc: ready_to_compile
        find . -name '*.class' | xargs rm -f # Don't let javadoc see these
Index: gzz/TODO
diff -u gzz/TODO:1.381 gzz/TODO:1.382
--- gzz/TODO:1.381      Sat Nov  9 09:42:38 2002
+++ gzz/TODO    Sat Nov  9 15:19:25 2002
@@ -211,6 +211,7 @@
        + better algorithm for CullingCoordSys. Uses now parallel
           bounding boxes. Fast, but not very efficient.
     tjl:
+       - use back buffer for libpaper
        + CoordSys::DistordCoords::canPerformGL() returns false.
           Define action (=complain in stderr?) when trying to use
          distorted coordsys with vobs calling directly CallGL.
Index: gzz/gfx/jni/GzzGL-jni.cxx
diff -u gzz/gfx/jni/GzzGL-jni.cxx:1.58 gzz/gfx/jni/GzzGL-jni.cxx:1.59
--- gzz/gfx/jni/GzzGL-jni.cxx:1.58      Fri Nov  1 06:24:11 2002
+++ gzz/gfx/jni/GzzGL-jni.cxx   Sat Nov  9 15:19:25 2002
@@ -795,25 +795,51 @@
       bytevectors.remove(id);
 }
 
-JNIEXPORT void JNICALL 
Java_gzz_gfx_gl_GL_impl_1ByteVector_1readFromBuffer_1ubytes
-  (JNIEnv *env, jclass, jint id, jint winid, jstring buffer, jint x, jint y, 
jint w, jint h, jstring format) 
+JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1readFromBuffer
+  (JNIEnv *env, jclass, jint id, jint winid, jstring buffer, 
+       jint x, jint y, jint w, jint h, 
+       jstring format, jstring type) 
 {
     setWindow(winid);
     ByteVector *v = bytevectors[id];
     GLenum buf = tokenFromJstring(env, buffer);
     GLenum form = tokenFromJstring(env, format);
+    GLenum typ = tokenFromJstring(env, type);
 
     glPushAttrib(GL_PIXEL_MODE_BIT);
     glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
     glReadBuffer(buf);
     glPixelStorei(GL_PACK_ROW_LENGTH, 0);
     glPixelStorei(GL_PACK_ALIGNMENT, 1);
-    glReadPixels(x, y, w, h, form, GL_UNSIGNED_BYTE, &((*v)[0]));
+    glReadPixels(x, y, w, h, form, typ, &((*v)[0]));
     GLERR
     glPopClientAttrib();
     glPopAttrib();
     releaseWindow();
 }
+
+JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1drawPixels
+  (JNIEnv *env, jclass, jint id, jint winid, 
+       jint x, jint y, jfloat z, jint w, jint h, 
+       jstring format, jstring type) 
+{
+    setWindow(winid);
+    ByteVector *v = bytevectors[id];
+    GLenum form = tokenFromJstring(env, format);
+    GLenum typ = tokenFromJstring(env, type);
+
+    glPushAttrib(GL_PIXEL_MODE_BIT);
+    glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+    glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+    glRasterPos3f(x, y, z);
+    glDrawPixels(w, h, form, typ, &((*v)[0]));
+    GLERR
+    glPopClientAttrib();
+    glPopAttrib();
+    releaseWindow();
+}
+
 
 JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1get__II
  (JNIEnv *env, jclass, jint id, jint ind) {
Index: gzz/gfx/libcallgl/callgl.cxx
diff -u gzz/gfx/libcallgl/callgl.cxx:1.34 gzz/gfx/libcallgl/callgl.cxx:1.35
--- gzz/gfx/libcallgl/callgl.cxx:1.34   Mon Nov  4 03:29:35 2002
+++ gzz/gfx/libcallgl/callgl.cxx        Sat Nov  9 15:19:25 2002
@@ -237,6 +237,41 @@
                    atoi(v[3].c_str()), 
                    getToken(v[4]),
                    GL_FLOAT, &pixels[0]);
+       } else if (checkfunc(v, "SeparableFilter2D", 6, true)) {
+           vector<GLfloat> filters = getfv(v, 6);
+           int w = atoi(v[3].c_str());
+           int h = atoi(v[4].c_str());
+
+           glSeparableFilter2D(
+                   getToken(v[1]),
+                   getToken(v[2]),
+                   w, h,
+                   getToken(v[5]),
+                   GL_FLOAT,
+                   &(filters[0]),
+                   &(filters[w]));
+
+       } else if (checkfunc(v, "ConvolutionFilter2D", 6, true)) {
+           vector<GLfloat> filters = getfv(v, 6);
+           int w = atoi(v[3].c_str());
+           int h = atoi(v[4].c_str());
+
+           glConvolutionFilter2D(
+                   getToken(v[1]),
+                   getToken(v[2]),
+                   w, h,
+                   getToken(v[5]),
+                   GL_FLOAT,
+                   &(filters[0]));
+           
+       } else if (checkfunc(v, "ConvolutionParameter", 3, true)) {
+         if (v.size() > 4) {
+           vector<GLfloat> params = getfv(v, 3, 4);
+           glConvolutionParameterfv(getToken(v[1]), getToken(v[2]), 
&params[0]);
+         } else {
+           glConvolutionParameterf(getToken(v[1]), getToken(v[2]), 
getTokenf(v[3]));
+         }
+
        } else if (checkfunc(v, "TexEnv", 3, true)) {
          if (v.size() > 4) {
            vector<GLfloat> params = getfv(v, 3, 4);
Index: gzz/gfx/librenderables/renderables.py
diff -u gzz/gfx/librenderables/renderables.py:1.133 
gzz/gfx/librenderables/renderables.py:1.134
--- gzz/gfx/librenderables/renderables.py:1.133 Sat Nov  9 13:32:52 2002
+++ gzz/gfx/librenderables/renderables.py       Sat Nov  9 15:19:26 2002
@@ -65,6 +65,13 @@
        "pre" : (lambda v, p : "GLubyte * "+v+" = " \
                    " &((*bytevectors.get("+p+"))[0]);")
     },
+    "GLToken" : {
+       "Java": "String",
+       "JNI": "jstring",
+       "CXX": "GLenum",
+       "pre" : (lambda v, p : "GLenum "+v+" = " \
+                   "tokenFromJstring(env, "+p+");")
+    }
 }
 
 rs = [
@@ -103,7 +110,59 @@
            """,
 },
 
+{
+    "Type": "1",
+    "Name": "DrawPixels",
+    "Data" : "GLenum format, type; int w,h; GLubyte *bytes; ",
+    "Params" : "int w, int h,  GLToken format, GLToken type, ByteVector bytes",
+    "ParamCode" : """
+       this->w = w;
+       this->h = h;
+       this->format = format;
+       this->type = type;
+       this->bytes = bytes;
+    """,
+    "RenderCode" : """
+       glPushAttrib(GL_PIXEL_MODE_BIT);
+       glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+       glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+       glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+       ZPt p = coords1.transform(ZPt(0,0,0));
+       glRasterPos3f(p.x, p.y, p.z);
+       glDrawPixels(w, h, format, type, bytes);
+       GLERR
+       glPopClientAttrib();
+       glPopAttrib();
+    """,
+},
 
+{
+    "Type": "1",
+    "Name": "ReadPixels",
+    "Data" : "GLenum format, type; int w,h; GLubyte *bytes; ",
+    "Params" : "int w, int h,  GLToken format, GLToken type, ByteVector bytes",
+    "ParamCode" : """
+       this->w = w;
+       this->h = h;
+       this->format = format;
+       this->type = type;
+       this->bytes = bytes;
+    """,
+    "RenderCode" : """
+       glPushAttrib(GL_PIXEL_MODE_BIT);
+       glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+       glPixelStorei(GL_PACK_ROW_LENGTH, 0);
+       glPixelStorei(GL_PACK_ALIGNMENT, 1);
+       ZPt p = coords1.transform(ZPt(0,0,0));
+       glRasterPos3f(p.x, p.y, p.z);
+       float ras[4];
+       glGetFloatv(GL_CURRENT_RASTER_POSITION, ras);
+       glReadPixels(ras[0], ras[1], w, h, format, type, bytes);
+       GLERR
+       glPopClientAttrib();
+       glPopAttrib();
+    """,
+},
 
 {
     "Type": "1",
@@ -1710,6 +1769,11 @@
 },
 ]
 
+def javaParam(p):
+    if convert.has_key(p[0]) and convert[p[0]].has_key("Java"):
+       return convert[p[0]]["Java"] + " " + p[1]
+    return p[0]+" "+p[1];
+
 def iddedParam(p):
     if p[0] in idded : return p[1] + ".getId()"
     return p[1];
@@ -1717,7 +1781,7 @@
 
 def idintParam(p):
     if p[0] in idded : return "int "+p[1]
-    return p[0]+" "+p[1];
+    return javaParam(p)
 
 def jniparam(p):
     if convert.has_key(p[0]) :
@@ -1781,7 +1845,7 @@
 
     cls += (" static public "+Name+" create"+Name 
        + "(" 
-       + Params + ") { \n return new "+Name+"("+createImpl+"("
+       + ",".join([javaParam(p) for p in params]) + ") { \n return new 
"+Name+"("+createImpl+"("
        + string.join([ iddedParam(p) for p in params ], ",") 
        + ")" + string.join([","+p[1] for p in idparams],"")+");\n"
        + "}\n")
Index: gzz/gzz/client/gl/GLScreen.java
diff -u gzz/gzz/client/gl/GLScreen.java:1.38 
gzz/gzz/client/gl/GLScreen.java:1.39
--- gzz/gzz/client/gl/GLScreen.java:1.38        Fri Nov  1 20:23:45 2002
+++ gzz/gzz/client/gl/GLScreen.java     Sat Nov  9 15:19:26 2002
@@ -35,7 +35,7 @@
 import java.util.HashMap;
 
 public class GLScreen extends GraphicsAPI.Window {
-public static final String rcsid = "$Id: GLScreen.java,v 1.38 2002/11/02 
01:23:45 benja Exp $";
+public static final String rcsid = "$Id: GLScreen.java,v 1.39 2002/11/09 
20:19:26 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -265,9 +265,9 @@
     public int[] readPixels(int x, int y, int w, int h) {
        GL.ByteVector v = GL.createByteVector(w*h*4);
        Dimension d = getSize();
-       v.readFromBuffer_ubytes(window, "FRONT",
+       v.readFromBuffer(window, "FRONT",
                    x, d.height-y-h, w, h,
-                   "BGRA");
+                   "BGRA", "UNSIGNED_BYTE");
        int[] res = v.getInts();
        // Exchange to get it right way up
        for(int row = 0; row < h/2; row++) {
Index: gzz/gzz/gfx/gl/GL.java
diff -u gzz/gzz/gfx/gl/GL.java:1.20 gzz/gzz/gfx/gl/GL.java:1.21
--- gzz/gzz/gfx/gl/GL.java:1.20 Sat Nov  2 09:51:36 2002
+++ gzz/gzz/gfx/gl/GL.java      Sat Nov  9 15:19:26 2002
@@ -664,13 +664,25 @@
         * @param h The height to read
         * @param format The format which to store in the vector, 
         *              e.g. "RGB", "RGBA"
+        * @param type The type to read to, e.g. "FLOAT" or "UNSIGNED_BYTE"
         */
-       public void readFromBuffer_ubytes(Window win,
+       public void readFromBuffer(Window win,
            String buffer, 
            int x, int y, int width, int height, 
-           String format) {
-           impl_ByteVector_readFromBuffer_ubytes(getId(), win.getId(),
-               buffer, x, y, width, height, format);
+           String format, String type) {
+           impl_ByteVector_readFromBuffer(getId(), win.getId(),
+               buffer, x, y, width, height, format, type);
+       }
+
+       /** 
+        * @param x,y The coordinates to set raster position to.
+        *              This is a bit kludgy...
+        */
+       public void drawPixels(Window win,
+               int x, int y, float z, int width, int height,
+               String format, String type) {
+           impl_ByteVector_drawPixels(getId(), win.getId(),
+                   x, y, z, width, height, format, type);
        }
 
        /** Get the values from the vector as an array of bytes.
@@ -701,10 +713,14 @@
     static private native int createByteVectorImpl(int size);
     static private native void deleteByteVector(int id);
 
-    static private native void impl_ByteVector_readFromBuffer_ubytes(
+    static private native void impl_ByteVector_readFromBuffer(
            int id, int winid, String buffer,
            int x, int y, int width, int height, 
-           String format) ;
+           String format, String type) ;
+    static private native void impl_ByteVector_drawPixels(
+           int id, int winid, 
+           int x, int y, float z, int width, int height, 
+           String format, String type) ;
     static private native int impl_ByteVector_get(int id, int ind);
     static private native byte[] impl_ByteVector_get(int id);
     static private native int[] impl_ByteVector_getInts(int id);




reply via email to

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