gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob ./Makefile include/vob/vobs/Trivial.hxx ...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob ./Makefile include/vob/vobs/Trivial.hxx ...
Date: Tue, 11 Mar 2003 06:24:29 -0500

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/03/11 06:24:29

Modified files:
        .              : Makefile 
        include/vob/vobs: Trivial.hxx 
        org/nongnu/libvob/gl: GLRen.java 
        src/jni        : GLRen.template.java Main.cxx Makefile 
        src/util       : Makefile 
        test/tools     : gfx.py 
Added files:
        include/vob    : Debug.hxx 
        include/vob/vobs: Pixel.hxx 
        org/nongnu/libvob/gl: GLCache.java 

Log message:
        Now we get to JNI methods... next: actual GL rendering

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/Makefile.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/Debug.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Pixel.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Trivial.hxx.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/GLCache.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/GLRen.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/GLRen.template.java.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.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Makefile.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/util/Makefile.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/tools/gfx.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: libvob/Makefile
diff -u libvob/Makefile:1.8 libvob/Makefile:1.9
--- libvob/Makefile:1.8 Mon Mar 10 14:19:36 2003
+++ libvob/Makefile     Tue Mar 11 06:24:28 2003
@@ -1,6 +1,6 @@
 include rules.mk
 
-SUBDIRS = ctest src/trans src/util src/texture src/jni src/os
+SUBDIRS = ctest src/trans src/util src/texture src/os src/jni 
 
 RAWSRC = `find org/ -name "*.java"` 
 
@@ -16,6 +16,8 @@
 
 ctest: src/trans
 
+src/jni: src/os src/texture src/util src/trans
+
 subdirs: $(SUBDIRS)
 
 tags::
@@ -40,17 +42,19 @@
 #  coordsysid::
 #      python -c 'import random; print random.randrange(2**31-1)'
 
-GLLIB=LD_LIBRARY_PATH=/usr/lib:gfx
+GLLIB=LD_LIBRARY_PATH=/usr/lib:src/jni
 
 runjython: 
        $(GLLIB) $(JYTHON) $(DBG)
 
-test::  # Use: make test TEST=test/gzz/vob/vobmatcher.test, to run a single 
test.
+test:: test-awt test-gl
+
+test-awt::  # Use: make test TEST=test/gzz/vob/vobmatcher.test, to run a 
single test.
        $(GLLIB) $(JYTHON) test/testutil.py -f GL $(DBG) $(TEST)
 test-gl::
        $(GLLIB) $(JYTHON) test/testutil.py -Dgzzclient=gl -f AWT $(DBG) jni 
$(TEST)
 
-testbugs::
+testbugs-awt::
        $(GLLIB) $(JYTHON) test/testutil.py -f \* $(DBG) $(TEST)
 testbugs-gl::
        $(GLLIB) $(JYTHON) test/testutil.py -Dgzzclient=gl -f \* $(DBG) jni 
$(TEST)
Index: libvob/include/vob/vobs/Trivial.hxx
diff -u libvob/include/vob/vobs/Trivial.hxx:1.9 
libvob/include/vob/vobs/Trivial.hxx:1.10
--- libvob/include/vob/vobs/Trivial.hxx:1.9     Sat Mar  8 14:45:47 2003
+++ libvob/include/vob/vobs/Trivial.hxx Tue Mar 11 06:24:28 2003
@@ -34,7 +34,6 @@
 
 
 #ifndef VOB_DEFINED
-#define VOB_VOBS_DEFINING_VOB_DEFINED
 #define VOB_DEFINED(t)
 #endif
 
@@ -75,30 +74,37 @@
 
 VOB_DEFINED(CallList);
 
-#if 0
-struct StupidLinestrip {
-    vector<float> arr;
-
-    void setParams(const vector<float> &arr) {
-       this->arr = arr;
+struct CallListCoorded : public CallList {
+    enum { NTrans = 1 };
+    template<class T> void render(const T &t) const {
+       glPushMatrix();
+       if(t.performGL()) {
+           glCallList(no.get());
+       } else {
+           std::cout << "Error: CallistCoorded with non-glperformable.\n";
+       }
+       glPopMatrix();
     }
+};
+VOB_DEFINED(CallListCoorded);
 
-    template<class T> void render(const T &t0, const T &t1) const {
-       glBegin(GL_LINE_STRIP);
-       for(unsigned i=0; i+1<arr.size(); i+=2) {
-           ZPt p(arr[i], arr[i+1], 0);
-           coords1.vertex(p);
+struct CallListBoxCoorded : public CallList {
+    enum { NTrans = 1 };
+    template<class T> void render(const T &t) const {
+       glPushMatrix();
+       if(t.performGL()) {           
+           Pt boxwh = t.getSqSize();
+            glScalef(boxwh.x, boxwh.y, 1.0);
+
+           glCallList(no.get());
+       } else {
+           std::cout << "Error: CallistCoorded with non-glperformable.\n";
        }
-       glEnd();
+       glPopMatrix();
     }
 };
+VOB_DEFINED(CallListBoxCoorded);
 
-VOB_DEFINED(StupidLinestrip);
-#endif
-
-#ifdef VOB_VOBS_DEFINING_VOB_DEFINED
-#undef VOB_DEFINED
-#endif
 
 }}
 
Index: libvob/org/nongnu/libvob/gl/GLRen.java
diff -u libvob/org/nongnu/libvob/gl/GLRen.java:1.2 
libvob/org/nongnu/libvob/gl/GLRen.java:1.3
--- libvob/org/nongnu/libvob/gl/GLRen.java:1.2  Sat Mar  8 14:45:47 2003
+++ libvob/org/nongnu/libvob/gl/GLRen.java      Tue Mar 11 06:24:29 2003
@@ -34,17 +34,17 @@
     public static Vob createCallList(String s) {
        return createCallList(GL.createDisplayList(s));
     }
-    /*
-    public static Vob createMotionCallList(String still, String motion) {
-       return createMotionCallList(GL.createDisplayList(still),
-                                   GL.createDisplayList(motion));
-    }
     public static Vob createCallListCoorded(String s) {
        return createCallListCoorded(GL.createDisplayList(s));
     }
     public static Vob createCallListBoxCoorded(String s) {
        return createCallListBoxCoorded(GL.createDisplayList(s));
     }
+    /*
+    public static Vob createMotionCallList(String still, String motion) {
+       return createMotionCallList(GL.createDisplayList(still),
+                                   GL.createDisplayList(motion));
+    }
     */
 
 
@@ -69,6 +69,28 @@
  return _; }
 
 static private native int implcreateCallList(int p0) ; 
+static public class CallListCoorded extends GL.Renderable1JavaObject  { 
private CallListCoorded(int i) { super(i); }
+GL.DisplayList p0;
+}
+static public CallListCoorded createCallListCoorded(GL.DisplayList p0) { 
+CallListCoorded _ = new CallListCoorded(
+implcreateCallListCoorded(p0.getId()));
+_.p0 = p0;
+
+ return _; }
+
+static private native int implcreateCallListCoorded(int p0) ; 
+static public class CallListBoxCoorded extends GL.Renderable1JavaObject  { 
private CallListBoxCoorded(int i) { super(i); }
+GL.DisplayList p0;
+}
+static public CallListBoxCoorded createCallListBoxCoorded(GL.DisplayList p0) { 
+CallListBoxCoorded _ = new CallListBoxCoorded(
+implcreateCallListBoxCoorded(p0.getId()));
+_.p0 = p0;
+
+ return _; }
+
+static private native int implcreateCallListBoxCoorded(int p0) ; 
 
 
 }
Index: libvob/src/jni/GLRen.template.java
diff -u libvob/src/jni/GLRen.template.java:1.2 
libvob/src/jni/GLRen.template.java:1.3
--- libvob/src/jni/GLRen.template.java:1.2      Sat Mar  8 14:45:47 2003
+++ libvob/src/jni/GLRen.template.java  Tue Mar 11 06:24:29 2003
@@ -33,16 +33,16 @@
     public static Vob createCallList(String s) {
        return createCallList(GL.createDisplayList(s));
     }
-    /*
-    public static Vob createMotionCallList(String still, String motion) {
-       return createMotionCallList(GL.createDisplayList(still),
-                                   GL.createDisplayList(motion));
-    }
     public static Vob createCallListCoorded(String s) {
        return createCallListCoorded(GL.createDisplayList(s));
     }
     public static Vob createCallListBoxCoorded(String s) {
        return createCallListBoxCoorded(GL.createDisplayList(s));
+    }
+    /*
+    public static Vob createMotionCallList(String still, String motion) {
+       return createMotionCallList(GL.createDisplayList(still),
+                                   GL.createDisplayList(motion));
     }
     */
 
Index: libvob/src/jni/Main.cxx
diff -u libvob/src/jni/Main.cxx:1.4 libvob/src/jni/Main.cxx:1.5
--- libvob/src/jni/Main.cxx:1.4 Mon Mar 10 04:49:31 2003
+++ libvob/src/jni/Main.cxx     Tue Mar 11 06:24:29 2003
@@ -31,17 +31,17 @@
 
 #include <vob/Texture.hxx>
 #include <vob/buildmipmaps.hxx>
-
-#define DBG(cname) if(!cname);else (std::cout << "CallGL: ")
+#include <vob/Debug.hxx>
 
 namespace Vob {
 namespace JNI {
-bool dbg;
-bool dbg_event;
+DBGVAR(dbg, "JNI.general");
+DBGVAR(dbg_event, "JNI.event");
 
 ObjectStorer<Vob0> vob0s("Vob0");
 ObjectStorer<Vob1> vob1s("Vob1");
 ObjectStorer<Vob2> vob2s("Vob2");
+ObjectStorer<Vob> vob3s("Vob3(none)");
 
 Os::WindowSystem *ws;
 
@@ -243,8 +243,9 @@
 
 extern "C" {
 
+#define jf(t, rootname) JNIEXPORT t JNICALL 
Java_org_nongnu_libvob_gl_GL_##rootname
 
-JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_init
+jf(jint, init)
   (JNIEnv *env, jclass, jint) {
     static int inited = 0;
     if(inited++) {
@@ -271,25 +272,25 @@
 
 // Renderable
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable0
+jf(void, deleteRenderable0)
   (JNIEnv *, jclass, jint id) {
       DBG(dbg) << "Delete renderable0 "<<id<<"\n";
       vob0s.remove(id);
   }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable1
+jf(void, deleteRenderable1)
   (JNIEnv *, jclass, jint id) {
       DBG(dbg) << "Delete renderable1 "<<id<<"\n";
       vob1s.remove(id);
   }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable2
+jf(void, deleteRenderable2)
   (JNIEnv *, jclass, jint id) {
       DBG(dbg) << "Delete renderable2 "<<id<<"\n";
       vob2s.remove(id);
   }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable3
+jf(void, deleteRenderable3)
   (JNIEnv *, jclass, jint id) {
       DBG(dbg) << "Delete renderable3 "<<id<<"\n";
       vob3s.remove(id);
@@ -299,7 +300,7 @@
 
 // RenderingSurface
 
-JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_createStableRenderingSurfaceImpl
+jf(jint, createStableRenderingSurfaceImpl)
   (JNIEnv *env, jclass, jint w, jint h) {
        Os::RenderingSurface *win = ws->openStableOffScreen(w, h);
        return windows.add(win);
@@ -307,7 +308,7 @@
 
 // Window
 
-JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_createWindowImpl
+jf(jint, createWindowImpl)
   (JNIEnv *env, jclass, jint x, jint y, jint w, jint h, jobject eh) {
       DBG(dbg) << "Creating new window for Java "<<x<<" "<<y<<" "<<w<<" 
"<<h<<"\n";
       jobject ehglobal = env->NewGlobalRef(eh);
@@ -319,7 +320,7 @@
       return windows.add(win);
   }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteWindow
+jf(void, deleteWindow)
   (JNIEnv *env, jclass, jint id) {
 
       // Window *w = windows.get(id);
@@ -328,7 +329,7 @@
       windows.remove(id);
   }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_getWindowSize
+jf(void, getWindowSize)
   (JNIEnv *env, jclass, jint id, jobject rect) {
       Os::RenderingSurface *win = windows.get(id);
       int xywh[4];
@@ -348,30 +349,30 @@
 
   }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_addTimeoutWindow
+jf(void, addTimeoutWindow)
   (JNIEnv *env, jclass, jint id, jint ms, jint tid) {
       Os::Window *w = (Os::Window *)windows.get(id);
       w->addTimeout(ms, tid);
   }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1setCurrent
+jf(void, impl_1Window_1setCurrent)
   (JNIEnv *env, jclass, jint id) {
       setWindow(id);
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1release
+jf(void, impl_1Window_1release)
   (JNIEnv *env, jclass, jint id) {
       releaseWindow();
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1move
+jf(void, impl_1Window_1move)
   (JNIEnv *env, jclass, jint id, jint x, jint y) {
       Os::Window *w = (Os::Window *)windows.get(id);
       DBG(dbg) << "Move window "<<id<<" "<<x<<" "<<y<<" at "<<(int)w<<"\n";
       w->move(x,y);
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1resize
+jf(void, impl_1Window_1resize)
   (JNIEnv *env, jclass, jint id, jint wid, jint h) {
       Os::Window *w = (Os::Window *)windows.get(id);
       w->resize(wid,h);
@@ -379,7 +380,7 @@
 
 
 // Texture
-JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1createTexture
+jf(jint, impl_1createTexture)
   (JNIEnv *, jclass) {
       setWindow();
       GLuint ret;
@@ -390,7 +391,7 @@
       return ret;
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1deleteTexture
+jf(void, impl_1deleteTexture)
   (JNIEnv *, jclass, jint id) {
       setWindow();
       GLuint rel = id;
@@ -416,7 +417,7 @@
     return hasExtension;
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1loadNull2D
+jf(void, 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);
@@ -431,7 +432,7 @@
     GLERR
   }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1texImage2D
+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) {
@@ -449,7 +450,7 @@
   }
 
 
-JNIEXPORT jbyteArray JNICALL 
Java_gzz_gfx_gl_GL_impl_1Texture_1getCompressedTexImage
+jf(jbyteArray, impl_1Texture_1getCompressedTexImage)
   (JNIEnv *env, jclass, jint id, jint lod) {
       int size;
       glBindTexture(GL_TEXTURE_2D, id);
@@ -464,7 +465,7 @@
      return arr;
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1getTexImage
+jf(void, impl_1Texture_1getTexImage)
  (JNIEnv *env, jclass, jint id, jint level, jstring jformat, jstring jtype,
     jbyteArray jdata) {
     glBindTexture(GL_TEXTURE_2D, id);
@@ -486,7 +487,7 @@
 
 
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1compressedTexImage
+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);
@@ -503,7 +504,7 @@
 
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1downsampleInto
+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);
@@ -535,8 +536,8 @@
 
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1copyTexImage2D(
-    JNIEnv *env, jclass, jint id, jint wid, jstring bufferstr,
+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) {
@@ -567,7 +568,7 @@
       return p;
 }
 
-JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1shade
+jf(jint, impl_1Texture_1shade)
   (JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp, 
        jstring internalFormat,
        jstring format,
@@ -657,7 +658,7 @@
 
 
 // OpenGL Program
-JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1createProgram
+jf(jint, impl_1createProgram)
   (JNIEnv *, jclass) {
       setWindow();
       GLuint ret;
@@ -669,7 +670,7 @@
       return ret;
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1deleteProgram
+jf(void, impl_1deleteProgram)
   (JNIEnv *, jclass, jint id) {
 #ifdef GL_VERTEX_PROGRAM_ARB
       setWindow();
@@ -679,7 +680,7 @@
 #endif
 }
 
-JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1Program_1load
+jf(jint, impl_1Program_1load)
   (JNIEnv *env, jclass, jint id, jstring prog) {
 #ifdef GL_VERTEX_PROGRAM_ARB
       setWindow();
@@ -693,7 +694,7 @@
 
 // DisplayList
 
-JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_createDisplayListImpl
+jf(jint, createDisplayListImpl)
   (JNIEnv *, jclass) {
       setWindow();
       int l = glGenLists(1);
@@ -704,7 +705,7 @@
       }
       return l;
   }
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_startCompile
+jf(void, startCompile)
   (JNIEnv *, jclass, jint l, jint wid) {
       DBG(dbg) << "Start list compilation "<<l<<"\n";
 
@@ -714,7 +715,7 @@
       glNewList(l, GL_COMPILE);
       GLERR
   }
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_endCompile
+jf(void, endCompile)
   (JNIEnv *, jclass, jint, jint wid) {
       DBG(dbg) << "End list compilation\n";
       GLERR
@@ -724,7 +725,7 @@
       releaseWindow();
   }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_compileCallGL
+jf(void, compileCallGL)
   (JNIEnv *env, jclass, jint l, jstring s) {
       std::string utf = jstr2stdstr(env, s);
       DBG(dbg) << "got str\n";
@@ -732,21 +733,21 @@
       DBG(dbg) << "called\n";
   }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteDisplayList
+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";
   }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1DisplayList_1call
+jf(void, impl_1DisplayList_1call)
   (JNIEnv *, jclass, jint l, jint w) {
       setWindow(w);
       glCallList(l);
       releaseWindow();
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1DisplayList_1call0
+jf(void, impl_1DisplayList_1call0)
   (JNIEnv *, jclass, jint l) {
       glCallList(l);
 }
@@ -754,20 +755,20 @@
 
 // ByteVector
 //
-JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_createByteVectorImpl
+jf(jint, createByteVectorImpl)
   (JNIEnv *, jclass, jint size) {
       ByteVector *vec = new ByteVector(size);
       DBG(dbg) << "Alloc byte vector "<<(int)vec<<"\n";
       return bytevectors.add(vec);
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteByteVector
+jf(void, deleteByteVector)
   (JNIEnv *, jclass, jint id) {
       DBG(dbg) << "Delete byte vector "<<(int)bytevectors[id]<<"\n";
       bytevectors.remove(id);
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1readFromBuffer
+jf(void, impl_1ByteVector_1readFromBuffer)
   (JNIEnv *env, jclass, jint id, jint winid, jstring buffer, 
        jint x, jint y, jint w, jint h, 
        jstring format, jstring type) 
@@ -790,7 +791,7 @@
     releaseWindow();
 }
 
-JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1drawPixels
+jf(void, impl_1ByteVector_1drawPixels)
   (JNIEnv *env, jclass, jint id, jint winid, 
        jint x, jint y, jfloat z, jint w, jint h, 
        jstring format, jstring type) 
@@ -813,12 +814,12 @@
 }
 
 
-JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1get__II
+jf(jint, impl_1ByteVector_1get__II)
  (JNIEnv *env, jclass, jint id, jint ind) {
     return (*bytevectors[id])[ind];
 }
 
-JNIEXPORT jbyteArray JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1get__I
+jf(jbyteArray, impl_1ByteVector_1get__I)
   (JNIEnv *env, jclass, jint id) {
     int len = bytevectors[id]->size();
     jbyteArray arr = env->NewByteArray(len);
@@ -826,7 +827,7 @@
     return arr;
 }
 
-JNIEXPORT jintArray JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1getInts
+jf(jintArray, impl_1ByteVector_1getInts)
   (JNIEnv *env, jclass, jint id) {
     int len = bytevectors[id]->size() / 4;
     jintArray arr = env->NewIntArray(len);
@@ -835,7 +836,7 @@
 }
 
 
-JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1shade
+jf(jint, impl_1ByteVector_1shade)
   (JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp, 
            jstring name, jobjectArray params) {
       setWindow();
@@ -854,6 +855,96 @@
       bytevectors[id]->resize(w * h * (d==0 ? 1 : d) * comp * 4);
       s->render( &p, w, h, (d==0?1:d), comp, (float*)&((*bytevectors[id])[0]));
       return 1;
+}
+
+
+jf(void, setDebugVar)
+  (JNIEnv *env, jclass, jstring name, jint value) {
+      std::string utf = jstr2stdstr(env, name);
+      Debug::var(utf.c_str()) = value;
+}
+
+jf(jint, getDebugVar)
+  (JNIEnv *env, jclass, jstring name) {
+      std::string utf = jstr2stdstr(env, name);
+      int value = Debug::var(utf.c_str()) ;
+      return value;
+}
+
+jf(jobjectArray, Java_gzz_gfx_gl_GL_getDebugVarNames)
+  (JNIEnv *env, jclass) {
+      vector<const char *> vec;
+      vec = Debug::getVarNames();
+      jclass strclass = env->FindClass("java/lang/String");
+      jobjectArray result = env->NewObjectArray(vec.size(), 
+                                 strclass, 0);
+      for(unsigned i=0; i<vec.size(); i++)
+         env->SetObjectArrayElement(result, i, 
+                         env->NewStringUTF(vec[i]));
+      return result;
+}
+
+jf(jstring, getGLString)
+  (JNIEnv *env, jclass, jstring name) {
+      std::string utf = jstr2stdstr(env, name);
+      const char *value = CallGL::getString(utf.c_str()) ;
+      return env->NewStringUTF(value);
+}
+
+jf(jfloatArray, getGLFloat)
+  (JNIEnv *env, jclass, jstring name) {
+      std::string utf = jstr2stdstr(env, name);
+      vector<float> vec = CallGL::getFloat(utf.c_str()) ;
+      jfloatArray result = env->NewFloatArray(vec.size());
+      env->SetFloatArrayRegion(result, 0, vec.size(), &vec[0]);
+      return result;
+}
+
+jf(jfloatArray, getGLProgram)
+  (JNIEnv *env, jclass, jstring j_target, jstring j_name) {
+      std::string target = jstr2stdstr(env, j_target);
+      std::string name = jstr2stdstr(env, j_name);
+      vector<float> vec = CallGL::getProgram(target.c_str(), name.c_str()) ;
+      jfloatArray result = env->NewFloatArray(vec.size());
+      env->SetFloatArrayRegion(result, 0, vec.size(), &vec[0]);
+      return result;
+}
+
+jf(jint, getGLProgrami)
+  (JNIEnv *env, jclass, jstring j_target, jint id, jstring j_name) {
+      GLenum target = tokenFromJstring(env, j_target);
+      GLenum name = tokenFromJstring(env, j_name);
+      glBindProgramARB(target, id);
+      GLint res;
+      glGetProgramivARB(target, name, &res);
+      glBindProgramARB(target, 0);
+      return res;
+}
+
+jf(jfloatArray, getGLTexParameterFloat)
+  (JNIEnv *env, jclass, jstring target, jint tex, jstring name) {
+      std::string utf_target = jstr2stdstr(env, target);
+      std::string utf = jstr2stdstr(env, name);
+      vector<float> vec = CallGL::getTexParameterFloat(utf_target.c_str(), 
tex, utf.c_str());
+      jfloatArray result = env->NewFloatArray(vec.size());
+      env->SetFloatArrayRegion(result, 0, vec.size(), &vec[0]);
+      return result;
+}
+
+jf(jfloatArray, getGLTexLevelParameterFloat)
+  (JNIEnv *env, jclass, jstring target, jint tex, jint level, jstring name) {
+      std::string utf_target = jstr2stdstr(env, target);
+      std::string utf = jstr2stdstr(env, name);
+      vector<float> vec = 
CallGL::getTexLevelParameterFloat(utf_target.c_str(), tex, level, utf.c_str()) ;
+      jfloatArray result = env->NewFloatArray(vec.size());
+      env->SetFloatArrayRegion(result, 0, vec.size(), &vec[0]);
+      return result;
+}
+
+jf(jstring, getGLTokenString)
+  (JNIEnv *env, jclass, jint value) {
+      const char *str = CallGL::getTokenString(value) ;
+      return env->NewStringUTF(str);
 }
 
 
Index: libvob/src/jni/Makefile
diff -u libvob/src/jni/Makefile:1.6 libvob/src/jni/Makefile:1.7
--- libvob/src/jni/Makefile:1.6 Mon Mar 10 09:26:18 2003
+++ libvob/src/jni/Makefile     Tue Mar 11 06:24:29 2003
@@ -1,8 +1,15 @@
 include ../../rules.mk
 
-sources = Gen.cxx GLRen.gen.cxx Main.cxx
+sources = Gen.cxx GLRen.gen.cxx Main.cxx 
 
-JNIOBJS=GLRen.gen.o
+CALLGL=../../../callgl
+CALLGLOBJS=$(CALLGL)/src/glwrapper/GL_wrapper.o $(CALLGL)/src/callgl.o
+
+OSOBJS=../os/Os-GLX.o 
+TEXTUREOBJS=../texture/Texture.o ../texture/Texture_pipetexture.o 
+UTILOBJS=../util/Perlin.o ../util/buildmipmaps.o ../util/Debug.o
+
+JNIOBJS=GLRen.gen.o Main.o $(OSOBJS) $(TEXTUREOBJS) $(UTILOBJS) $(CALLGLOBJS)
 
 EXTRAINCLUDE=-I${JAVAHOME}/include -I${JAVAHOME}/include/linux 
 
@@ -16,8 +23,8 @@
 GLRen.gen.cxx: Gen GLRen.template.java
        (cd ../..; src/jni/Gen)
 
-libvobjni.so: $(JNIOBJS)
-       $(CXXLINK) -rdynamic -fpic -o libGZZGL.so $(SHARED) $(CXXFLAGS) 
$(JNIOBJS) $(LIBS)
+libvobjni.so: $(JNIOBJS) Makefile
+       $(CXXLINK) -rdynamic -fpic -o libvobjni.so $(SHARED) $(CXXFLAGS) 
$(JNIOBJS) $(LIBS)
 
 
 include $(sources:.cxx=.dep)
Index: libvob/src/util/Makefile
diff -u libvob/src/util/Makefile:1.1 libvob/src/util/Makefile:1.2
--- libvob/src/util/Makefile:1.1        Mon Mar 10 04:50:56 2003
+++ libvob/src/util/Makefile    Tue Mar 11 06:24:29 2003
@@ -1,6 +1,6 @@
 include ../../rules.mk
 
-sources = Perlin.cxx buildmipmaps.cxx
+sources = Perlin.cxx buildmipmaps.cxx Debug.cxx
 
 all: $(sources:.cxx=.o) 
 
Index: libvob/test/tools/gfx.py
diff -u libvob/test/tools/gfx.py:1.2 libvob/test/tools/gfx.py:1.3
--- libvob/test/tools/gfx.py:1.2        Mon Mar 10 14:29:19 2003
+++ libvob/test/tools/gfx.py    Tue Mar 11 06:24:29 2003
@@ -45,7 +45,7 @@
        win = vob.GraphicsAPI.getInstance().createStableOffscreen(500, 500)
        _buf = GL.createByteVector(500*500*3)
        _drawbufvs = _realwin.createVobScene()
-       _drawbufvs.map.put(SolidBgVob(Color(0, 0, 0.2)))
+       _drawbufvs.map.put(vob.vobs.SolidBackdropVob(Color(0, 0, 0.2)))
        _drawbufvs.map.put(GLCache.getCallList("""
            Disable TEXTURE_2D
            Color 1 1 1 1
@@ -125,7 +125,7 @@
     if alsoRender:
        for i in range(0, len(src), 3):
            vs.map.clear()
-           vs.map.put(SolidBgVob(Color.red))
+           vs.map.put(vob.vobs.SolidBackdropVob(Color.red))
            d = TestSpotVob(src[i], src[i+1], src[i+2])
            vs.map.put(d, cs)
            render(vs)




reply via email to

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