gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] libvob ./rules.mk include/vob/Types.hxx include...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob ./rules.mk include/vob/Types.hxx include...
Date: Tue, 11 Mar 2003 07:10:32 -0500

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/03/11 07:10:32

Modified files:
        .              : rules.mk 
        include/vob    : Types.hxx 
        include/vob/jni: Define.hxx Generate.hxx Types.hxx 
        include/vob/vobs: Pixel.hxx 
        org/nongnu/libvob/gl: GLRen.java 
        src/jni        : Gen.cxx Main.cxx Makefile 
Added files:
        include/vob/jni: Strings.hxx 
        src/jni        : Strings.cxx 

Log message:
        Passing bytevectors... now core dumps

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/rules.mk.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/Types.hxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Strings.hxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Define.hxx.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Generate.hxx.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Types.hxx.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Pixel.hxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/GLRen.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Strings.cxx?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Gen.cxx.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Main.cxx.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Makefile.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: libvob/include/vob/Types.hxx
diff -u libvob/include/vob/Types.hxx:1.1 libvob/include/vob/Types.hxx:1.2
--- libvob/include/vob/Types.hxx:1.1    Sat Mar  8 14:47:29 2003
+++ libvob/include/vob/Types.hxx        Tue Mar 11 07:10:31 2003
@@ -9,18 +9,25 @@
     // need separate C++ types...
     
     class GLIndexBase {
+    protected:
        int index;
     public:
        explicit GLIndexBase(int index) : index(index) { };
        int get() const { return index; }
+       void operator=(int i) { index = i; }
     };
 
     template<int id> struct GLIndex : public GLIndexBase {
        GLIndex() : GLIndexBase(-1) { }
        explicit GLIndex(int index) : GLIndexBase(index) { }
+       void operator=(int i) { index = i; }
+       operator int() const {
+           return index;
+       }
     };
 
     typedef GLIndex<GL_LIST_MODE> DisplayListID;
+    typedef GLIndex<GL_INVALID_ENUM> Token;
 }
 
 #endif
Index: libvob/include/vob/jni/Define.hxx
diff -u libvob/include/vob/jni/Define.hxx:1.5 
libvob/include/vob/jni/Define.hxx:1.6
--- libvob/include/vob/jni/Define.hxx:1.5       Fri Feb 28 08:56:07 2003
+++ libvob/include/vob/jni/Define.hxx   Tue Mar 11 07:10:31 2003
@@ -55,7 +55,7 @@
 
 #define VOB_TEXT(z, i, ignored) doParam(t##i, p##i)
 
-#define BOOST_PP_LOCAL_LIMITS (1, 4)
+#define BOOST_PP_LOCAL_LIMITS (1, 10)
 #define BOOST_PP_LOCAL_MACRO(i)                                \
        template<BOOST_PP_ENUM_PARAMS(i , class T)>             \
                void operator()(                                \
Index: libvob/include/vob/jni/Generate.hxx
diff -u libvob/include/vob/jni/Generate.hxx:1.14 
libvob/include/vob/jni/Generate.hxx:1.15
--- libvob/include/vob/jni/Generate.hxx:1.14    Mon Mar 10 11:02:05 2003
+++ libvob/include/vob/jni/Generate.hxx Tue Mar 11 07:10:31 2003
@@ -102,7 +102,7 @@
        template<class T> void operator()(T &t) {
            doParam(t);
        }
-#define BOOST_PP_LOCAL_LIMITS (2, 4)
+#define BOOST_PP_LOCAL_LIMITS (2, 10)
 #define BOOST_PP_LOCAL_MACRO(i)                                \
        template<BOOST_PP_ENUM_PARAMS(i , class T)>             \
                void operator()(                                \
Index: libvob/include/vob/jni/Types.hxx
diff -u libvob/include/vob/jni/Types.hxx:1.13 
libvob/include/vob/jni/Types.hxx:1.14
--- libvob/include/vob/jni/Types.hxx:1.13       Mon Mar 10 00:38:19 2003
+++ libvob/include/vob/jni/Types.hxx    Tue Mar 11 07:10:31 2003
@@ -31,6 +31,8 @@
 #include <vob/util/ObjectStorer.hxx>
 #include <vob/os/Os.hxx>
 
+#include <vob/jni/Strings.hxx>
+
 namespace Vob {
 namespace JNI {
 
@@ -44,11 +46,14 @@
      */
     template<class T> class JParameter ;
 
+    typedef std::vector<GLubyte> ByteVector;
+
     extern ObjectStorer<Vob0> vob0s;
     extern ObjectStorer<Vob1> vob1s;
     extern ObjectStorer<Vob2> vob2s;
     extern ObjectStorer<Vob> vob3s;
     extern ObjectStorer<Os::RenderingSurface> windows;
+    extern ObjectStorer<ByteVector> bytevectors;
 
 #define START_VOB_JNI_CONVERSION(type, javaName_, jnitype_)    \
     struct JParameter<type> {                                  \
@@ -87,7 +92,7 @@
                out = in;                                       \
            END_VOB_JNI_CONVERSION
 
-#define VOB_JNI_CONVERSION_IDDED(type, javaName_)              \
+#define START_VOB_JNI_CONVERSION_IDDED(type, javaName_)                \
     struct JParameter<type> {                                  \
        typedef jint jniType;                           \
        static std::string javaParam(std::string paramPrefix) {         \
@@ -114,15 +119,25 @@
        static std::string jniStructCode(std::string paramPrefix) {     \
            return "_."+paramPrefix+"="+paramPrefix+";\n";                      
\
        }                                                       \
-       static void convert(JNIEnv *env, jint &in, type &out) {         \
-           out = type(in);                                     \
-           }};
+       static void convert(JNIEnv *env, jint &in, type &out) {         
 
 
     VOB_JNI_CONVERSION_ASSIGN(float, "float", jfloat)
     VOB_JNI_CONVERSION_ASSIGN(int, "int", jint)
 
-    VOB_JNI_CONVERSION_IDDED(DisplayListID, "GL.DisplayList")
+    START_VOB_JNI_CONVERSION(Token, "String", jstring)
+       out = tokenFromJstring(env, in);
+    END_VOB_JNI_CONVERSION
+
+
+    START_VOB_JNI_CONVERSION_IDDED(GLubyte *, "GL.ByteVector")
+       ByteVector *bv = bytevectors[in];
+       out = &((*bv)[0]);
+    END_VOB_JNI_CONVERSION
+
+    START_VOB_JNI_CONVERSION_IDDED(DisplayListID, "GL.DisplayList")
+           out = in;
+    END_VOB_JNI_CONVERSION
 
 }
 }
Index: libvob/include/vob/vobs/Pixel.hxx
diff -u libvob/include/vob/vobs/Pixel.hxx:1.1 
libvob/include/vob/vobs/Pixel.hxx:1.2
--- libvob/include/vob/vobs/Pixel.hxx:1.1       Tue Mar 11 06:24:28 2003
+++ libvob/include/vob/vobs/Pixel.hxx   Tue Mar 11 07:10:31 2003
@@ -32,6 +32,7 @@
 #include <vob/Types.hxx>
 
 #include <vob/Vec23.hxx>
+#include <vob/glerr.hxx>
 
 
 #ifndef VOB_DEFINED
@@ -45,10 +46,29 @@
 struct DrawPixels {
     enum { NTrans = 1 };
 
+    int w, h;
+    Token format;
+    Token type;
+    GLubyte *bytes;
+
     template<class F> void params(F &f) {
+       f(w, h, format, type, bytes);
+    }
 
+    template<class T> void render(const T &t) const {
+       glPushAttrib(GL_PIXEL_MODE_BIT);
+       glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+       glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+       glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+       ZPt p = t.transform(ZPt(0,0,0));
+       glRasterPos3f(p.x, p.y, p.z);
+       glDrawPixels(w, h, format, type, bytes);
+       GLERR
+       glPopClientAttrib();
+       glPopAttrib();
     }
 };
+VOB_DEFINED(DrawPixels);
 
 }
 }
Index: libvob/org/nongnu/libvob/gl/GLRen.java
diff -u libvob/org/nongnu/libvob/gl/GLRen.java:1.3 
libvob/org/nongnu/libvob/gl/GLRen.java:1.4
--- libvob/org/nongnu/libvob/gl/GLRen.java:1.3  Tue Mar 11 06:24:29 2003
+++ libvob/org/nongnu/libvob/gl/GLRen.java      Tue Mar 11 07:10:32 2003
@@ -91,6 +91,17 @@
  return _; }
 
 static private native int implcreateCallListBoxCoorded(int p0) ; 
+static public class DrawPixels extends GL.Renderable1JavaObject  { private 
DrawPixels(int i) { super(i); }
+GL.ByteVector p4;
+}
+static public DrawPixels createDrawPixels(int p0, int p1, String p2, String 
p3, GL.ByteVector p4) { 
+DrawPixels _ = new DrawPixels(
+implcreateDrawPixels(p0, p1, p2, p3, p4.getId()));
+_.p4 = p4;
+
+ return _; }
+
+static private native int implcreateDrawPixels(int p0, int p1, String p2, 
String p3, int p4) ; 
 
 
 }
Index: libvob/rules.mk
diff -u libvob/rules.mk:1.5 libvob/rules.mk:1.6
--- libvob/rules.mk:1.5 Mon Mar 10 00:38:19 2003
+++ libvob/rules.mk     Tue Mar 11 07:10:31 2003
@@ -1,5 +1,7 @@
 GCCVER=3.2
 
+.SUFFIXES: $(SUFFIXES) .dep .cxx
+
 CXX=g++-$(GCCVER)
 CXXLINK=gcc-$(GCCVER)
 
Index: libvob/src/jni/Gen.cxx
diff -u libvob/src/jni/Gen.cxx:1.9 libvob/src/jni/Gen.cxx:1.10
--- libvob/src/jni/Gen.cxx:1.9  Mon Mar 10 11:02:05 2003
+++ libvob/src/jni/Gen.cxx      Tue Mar 11 07:10:32 2003
@@ -36,7 +36,11 @@
 std::ostringstream VOB_TRANSCSTREAM;
 
 #include <vob/jni/Generate.hxx>
+
+// These are the include files that contain
+// the actual vobs and transforms
 #include <vob/vobs/Trivial.hxx>
+#include <vob/vobs/Pixel.hxx>
 #include <vob/LinearPrimitives.hxx>
 
 int main() {
@@ -70,6 +74,7 @@
     jni << "#include <vob/jni/Types.hxx>\n";
     jni << "#include <vob/jni/Define.hxx>\n";
     jni << "#include <vob/vobs/Trivial.hxx>\n";
+    jni << "#include <vob/vobs/Pixel.hxx>\n";
     jni << "#include <vob/LinearPrimitives.hxx>\n";
     jni << "using namespace Vob::JNI;\n";
     jni << "using namespace Vob::Primitives;\n";
Index: libvob/src/jni/Main.cxx
diff -u libvob/src/jni/Main.cxx:1.5 libvob/src/jni/Main.cxx:1.6
--- libvob/src/jni/Main.cxx:1.5 Tue Mar 11 06:24:29 2003
+++ libvob/src/jni/Main.cxx     Tue Mar 11 07:10:32 2003
@@ -27,6 +27,7 @@
 #include <callgl.hxx>
 
 #include <vob/jni/Types.hxx>
+#include <vob/jni/Strings.hxx>
 #include <vob/glerr.hxx>
 
 #include <vob/Texture.hxx>
@@ -45,7 +46,6 @@
 
 Os::WindowSystem *ws;
 
-typedef std::vector<GLubyte> ByteVector;
 ObjectStorer<ByteVector> bytevectors("bytevectors");
 
 ObjectStorer<Os::RenderingSurface> windows("windows");
@@ -98,19 +98,6 @@
     }
 }
 
-/** Converts std::string to jstring through UTF-8 transformation */
-jstring stdstr2jstr(JNIEnv *env, std::string stdstr) {
-  return env->NewStringUTF(stdstr.c_str());
-}
-
-/** Converts jstring to std::string through UTF-8 transformation */
-std::string jstr2stdstr(JNIEnv *env, jstring jstr) {
-  const char *strptr = env->GetStringUTFChars(jstr, 0);
-  std::string stdstr(strptr, env->GetStringUTFLength(jstr));
-  env->ReleaseStringUTFChars(jstr, strptr);
-  return stdstr;
-}
-
 struct GZZJNIEventHandler : public Os::Eventhandler {
 
     jobject globalRef;
@@ -397,12 +384,6 @@
       GLuint rel = id;
       glDeleteTextures(1, &rel);
       releaseWindow();
-}
-
-GLenum tokenFromJstring(JNIEnv *env, jstring token) {
-    std::string str = jstr2stdstr(env, token);
-    GLenum ret = CallGL::getTokenValue(str.c_str());
-    return ret;
 }
 
 bool hasGenMipmaps() {
Index: libvob/src/jni/Makefile
diff -u libvob/src/jni/Makefile:1.7 libvob/src/jni/Makefile:1.8
--- libvob/src/jni/Makefile:1.7 Tue Mar 11 06:24:29 2003
+++ libvob/src/jni/Makefile     Tue Mar 11 07:10:32 2003
@@ -1,6 +1,6 @@
 include ../../rules.mk
 
-sources = Gen.cxx GLRen.gen.cxx Main.cxx 
+sources = Gen.cxx GLRen.gen.cxx Main.cxx Strings.cxx
 
 CALLGL=../../../callgl
 CALLGLOBJS=$(CALLGL)/src/glwrapper/GL_wrapper.o $(CALLGL)/src/callgl.o
@@ -9,11 +9,11 @@
 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)
+JNIOBJS=GLRen.gen.o Main.o Strings.o $(OSOBJS) $(TEXTUREOBJS) $(UTILOBJS) 
$(CALLGLOBJS)
 
 EXTRAINCLUDE=-I${JAVAHOME}/include -I${JAVAHOME}/include/linux 
 
-LIBS=-lGL -lGLU
+LIBS=-lGL -lGLU -lstdc++
 
 all: $(sources:.cxx=.o) Gen libvobjni.so
 




reply via email to

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