/[libvob]/libvob/src/jni/Main.cxx
ViewVC logotype

Diff of /libvob/src/jni/Main.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by tjl, Mon Mar 10 09:49:31 2003 UTC revision 1.5 by tjl, Tue Mar 11 11:24:29 2003 UTC
# Line 31  Main.cxx Line 31  Main.cxx
31    
32  #include <vob/Texture.hxx>  #include <vob/Texture.hxx>
33  #include <vob/buildmipmaps.hxx>  #include <vob/buildmipmaps.hxx>
34    #include <vob/Debug.hxx>
 #define DBG(cname) if(!cname);else (std::cout << "CallGL: ")  
35    
36  namespace Vob {  namespace Vob {
37  namespace JNI {  namespace JNI {
38  bool dbg;  DBGVAR(dbg, "JNI.general");
39  bool dbg_event;  DBGVAR(dbg_event, "JNI.event");
40    
41  ObjectStorer<Vob0> vob0s("Vob0");  ObjectStorer<Vob0> vob0s("Vob0");
42  ObjectStorer<Vob1> vob1s("Vob1");  ObjectStorer<Vob1> vob1s("Vob1");
43  ObjectStorer<Vob2> vob2s("Vob2");  ObjectStorer<Vob2> vob2s("Vob2");
44    ObjectStorer<Vob> vob3s("Vob3(none)");
45    
46  Os::WindowSystem *ws;  Os::WindowSystem *ws;
47    
# Line 243  struct VobJNIEventHandler : public Os::E Line 243  struct VobJNIEventHandler : public Os::E
243    
244  extern "C" {  extern "C" {
245    
246    #define jf(t, rootname) JNIEXPORT t JNICALL Java_org_nongnu_libvob_gl_GL_##rootname
247    
248  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_init  jf(jint, init)
249    (JNIEnv *env, jclass, jint) {    (JNIEnv *env, jclass, jint) {
250      static int inited = 0;      static int inited = 0;
251      if(inited++) {      if(inited++) {
# Line 271  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G Line 272  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G
272    
273  // Renderable  // Renderable
274    
275  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable0  jf(void, deleteRenderable0)
276    (JNIEnv *, jclass, jint id) {    (JNIEnv *, jclass, jint id) {
277        DBG(dbg) << "Delete renderable0 "<<id<<"\n";        DBG(dbg) << "Delete renderable0 "<<id<<"\n";
278        vob0s.remove(id);        vob0s.remove(id);
279    }    }
280    
281  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable1  jf(void, deleteRenderable1)
282    (JNIEnv *, jclass, jint id) {    (JNIEnv *, jclass, jint id) {
283        DBG(dbg) << "Delete renderable1 "<<id<<"\n";        DBG(dbg) << "Delete renderable1 "<<id<<"\n";
284        vob1s.remove(id);        vob1s.remove(id);
285    }    }
286    
287  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable2  jf(void, deleteRenderable2)
288    (JNIEnv *, jclass, jint id) {    (JNIEnv *, jclass, jint id) {
289        DBG(dbg) << "Delete renderable2 "<<id<<"\n";        DBG(dbg) << "Delete renderable2 "<<id<<"\n";
290        vob2s.remove(id);        vob2s.remove(id);
291    }    }
292    
293  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable3  jf(void, deleteRenderable3)
294    (JNIEnv *, jclass, jint id) {    (JNIEnv *, jclass, jint id) {
295        DBG(dbg) << "Delete renderable3 "<<id<<"\n";        DBG(dbg) << "Delete renderable3 "<<id<<"\n";
296        vob3s.remove(id);        vob3s.remove(id);
# Line 299  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 300  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
300    
301  // RenderingSurface  // RenderingSurface
302    
303  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_createStableRenderingSurfaceImpl  jf(jint, createStableRenderingSurfaceImpl)
304    (JNIEnv *env, jclass, jint w, jint h) {    (JNIEnv *env, jclass, jint w, jint h) {
305          Os::RenderingSurface *win = ws->openStableOffScreen(w, h);          Os::RenderingSurface *win = ws->openStableOffScreen(w, h);
306          return windows.add(win);          return windows.add(win);
# Line 307  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G Line 308  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G
308    
309  // Window  // Window
310    
311  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_createWindowImpl  jf(jint, createWindowImpl)
312    (JNIEnv *env, jclass, jint x, jint y, jint w, jint h, jobject eh) {    (JNIEnv *env, jclass, jint x, jint y, jint w, jint h, jobject eh) {
313        DBG(dbg) << "Creating new window for Java "<<x<<" "<<y<<" "<<w<<" "<<h<<"\n";        DBG(dbg) << "Creating new window for Java "<<x<<" "<<y<<" "<<w<<" "<<h<<"\n";
314        jobject ehglobal = env->NewGlobalRef(eh);        jobject ehglobal = env->NewGlobalRef(eh);
# Line 319  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G Line 320  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G
320        return windows.add(win);        return windows.add(win);
321    }    }
322    
323  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteWindow  jf(void, deleteWindow)
324    (JNIEnv *env, jclass, jint id) {    (JNIEnv *env, jclass, jint id) {
325    
326        // Window *w = windows.get(id);        // Window *w = windows.get(id);
# Line 328  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 329  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
329        windows.remove(id);        windows.remove(id);
330    }    }
331    
332  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_getWindowSize  jf(void, getWindowSize)
333    (JNIEnv *env, jclass, jint id, jobject rect) {    (JNIEnv *env, jclass, jint id, jobject rect) {
334        Os::RenderingSurface *win = windows.get(id);        Os::RenderingSurface *win = windows.get(id);
335        int xywh[4];        int xywh[4];
# Line 348  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 349  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
349    
350    }    }
351    
352  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_addTimeoutWindow  jf(void, addTimeoutWindow)
353    (JNIEnv *env, jclass, jint id, jint ms, jint tid) {    (JNIEnv *env, jclass, jint id, jint ms, jint tid) {
354        Os::Window *w = (Os::Window *)windows.get(id);        Os::Window *w = (Os::Window *)windows.get(id);
355        w->addTimeout(ms, tid);        w->addTimeout(ms, tid);
356    }    }
357    
358  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1setCurrent  jf(void, impl_1Window_1setCurrent)
359    (JNIEnv *env, jclass, jint id) {    (JNIEnv *env, jclass, jint id) {
360        setWindow(id);        setWindow(id);
361  }  }
362    
363  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1release  jf(void, impl_1Window_1release)
364    (JNIEnv *env, jclass, jint id) {    (JNIEnv *env, jclass, jint id) {
365        releaseWindow();        releaseWindow();
366  }  }
367    
368  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1move  jf(void, impl_1Window_1move)
369    (JNIEnv *env, jclass, jint id, jint x, jint y) {    (JNIEnv *env, jclass, jint id, jint x, jint y) {
370        Os::Window *w = (Os::Window *)windows.get(id);        Os::Window *w = (Os::Window *)windows.get(id);
371        DBG(dbg) << "Move window "<<id<<" "<<x<<" "<<y<<" at "<<(int)w<<"\n";        DBG(dbg) << "Move window "<<id<<" "<<x<<" "<<y<<" at "<<(int)w<<"\n";
372        w->move(x,y);        w->move(x,y);
373  }  }
374    
375  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Window_1resize  jf(void, impl_1Window_1resize)
376    (JNIEnv *env, jclass, jint id, jint wid, jint h) {    (JNIEnv *env, jclass, jint id, jint wid, jint h) {
377        Os::Window *w = (Os::Window *)windows.get(id);        Os::Window *w = (Os::Window *)windows.get(id);
378        w->resize(wid,h);        w->resize(wid,h);
# Line 379  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 380  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
380    
381    
382  // Texture  // Texture
383  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1createTexture  jf(jint, impl_1createTexture)
384    (JNIEnv *, jclass) {    (JNIEnv *, jclass) {
385        setWindow();        setWindow();
386        GLuint ret;        GLuint ret;
# Line 390  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G Line 391  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G
391        return ret;        return ret;
392  }  }
393    
394  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1deleteTexture  jf(void, impl_1deleteTexture)
395    (JNIEnv *, jclass, jint id) {    (JNIEnv *, jclass, jint id) {
396        setWindow();        setWindow();
397        GLuint rel = id;        GLuint rel = id;
# Line 416  bool hasGenMipmaps() { Line 417  bool hasGenMipmaps() {
417      return hasExtension;      return hasExtension;
418  }  }
419    
420  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1loadNull2D  jf(void, impl_1Texture_1loadNull2D)
421    (JNIEnv *env, jclass, jint id, jint level, jstring internalFormat_s,    (JNIEnv *env, jclass, jint id, jint level, jstring internalFormat_s,
422      jint w, jint h, jint border, jstring format_s, jstring type_s) {      jint w, jint h, jint border, jstring format_s, jstring type_s) {
423      int internalFormat = tokenFromJstring(env, internalFormat_s);      int internalFormat = tokenFromJstring(env, internalFormat_s);
# Line 431  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 432  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
432      GLERR      GLERR
433    }    }
434    
435  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1texImage2D  jf(void, impl_1Texture_1texImage2D)
436    (JNIEnv *env, jclass, jint id, jint level, jstring internalFormat_s,    (JNIEnv *env, jclass, jint id, jint level, jstring internalFormat_s,
437      jint w, jint h, jint border, jstring format_s, jstring type_s,      jint w, jint h, jint border, jstring format_s, jstring type_s,
438      jbyteArray jdata) {      jbyteArray jdata) {
# Line 449  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 450  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
450    }    }
451    
452    
453  JNIEXPORT jbyteArray JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1getCompressedTexImage  jf(jbyteArray, impl_1Texture_1getCompressedTexImage)
454    (JNIEnv *env, jclass, jint id, jint lod) {    (JNIEnv *env, jclass, jint id, jint lod) {
455        int size;        int size;
456        glBindTexture(GL_TEXTURE_2D, id);        glBindTexture(GL_TEXTURE_2D, id);
# Line 464  JNIEXPORT jbyteArray JNICALL Java_gzz_gf Line 465  JNIEXPORT jbyteArray JNICALL Java_gzz_gf
465       return arr;       return arr;
466  }  }
467    
468  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1getTexImage  jf(void, impl_1Texture_1getTexImage)
469   (JNIEnv *env, jclass, jint id, jint level, jstring jformat, jstring jtype,   (JNIEnv *env, jclass, jint id, jint level, jstring jformat, jstring jtype,
470      jbyteArray jdata) {      jbyteArray jdata) {
471      glBindTexture(GL_TEXTURE_2D, id);      glBindTexture(GL_TEXTURE_2D, id);
# Line 486  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 487  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
487    
488    
489    
490  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1compressedTexImage  jf(void, impl_1Texture_1compressedTexImage)
491   (JNIEnv *env, jclass, jint id, jint level, jstring jinternalFormat, jint width, jint height,   (JNIEnv *env, jclass, jint id, jint level, jstring jinternalFormat, jint width, jint height,
492          jint border, jbyteArray jdata) {          jint border, jbyteArray jdata) {
493       int size = env->GetArrayLength(jdata);       int size = env->GetArrayLength(jdata);
# Line 503  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 504  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
504    
505  }  }
506    
507  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1downsampleInto  jf(void, impl_1Texture_1downsampleInto)
508    (JNIEnv *env, jclass, jint id, jint intoid, jstring targetstr, jint level, jstring internalFormat, jstring transferType)    (JNIEnv *env, jclass, jint id, jint intoid, jstring targetstr, jint level, jstring internalFormat, jstring transferType)
509  {  {
510      GLenum target = tokenFromJstring(env, targetstr);      GLenum target = tokenFromJstring(env, targetstr);
# Line 535  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 536  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
536    
537  }  }
538    
539  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1copyTexImage2D(  jf(void, impl_1Texture_1copyTexImage2D)
540      JNIEnv *env, jclass, jint id, jint wid, jstring bufferstr,      (JNIEnv *env, jclass, jint id, jint wid, jstring bufferstr,
541      jstring targetstr, jint level,      jstring targetstr, jint level,
542      jstring iforstring, jint x, jint y, jint w, jint h,      jstring iforstring, jint x, jint y, jint w, jint h,
543      jint border) {      jint border) {
# Line 567  Texture::TextureParam textureParams(JNIE Line 568  Texture::TextureParam textureParams(JNIE
568        return p;        return p;
569  }  }
570    
571  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1shade  jf(jint, impl_1Texture_1shade)
572    (JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp,    (JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp,
573          jstring internalFormat,          jstring internalFormat,
574          jstring format,          jstring format,
# Line 657  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G Line 658  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G
658    
659    
660  // OpenGL Program  // OpenGL Program
661  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1createProgram  jf(jint, impl_1createProgram)
662    (JNIEnv *, jclass) {    (JNIEnv *, jclass) {
663        setWindow();        setWindow();
664        GLuint ret;        GLuint ret;
# Line 669  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G Line 670  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G
670        return ret;        return ret;
671  }  }
672    
673  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1deleteProgram  jf(void, impl_1deleteProgram)
674    (JNIEnv *, jclass, jint id) {    (JNIEnv *, jclass, jint id) {
675  #ifdef GL_VERTEX_PROGRAM_ARB  #ifdef GL_VERTEX_PROGRAM_ARB
676        setWindow();        setWindow();
# Line 679  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 680  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
680  #endif  #endif
681  }  }
682    
683  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1Program_1load  jf(jint, impl_1Program_1load)
684    (JNIEnv *env, jclass, jint id, jstring prog) {    (JNIEnv *env, jclass, jint id, jstring prog) {
685  #ifdef GL_VERTEX_PROGRAM_ARB  #ifdef GL_VERTEX_PROGRAM_ARB
686        setWindow();        setWindow();
# Line 693  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G Line 694  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G
694    
695  // DisplayList  // DisplayList
696    
697  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_createDisplayListImpl  jf(jint, createDisplayListImpl)
698    (JNIEnv *, jclass) {    (JNIEnv *, jclass) {
699        setWindow();        setWindow();
700        int l = glGenLists(1);        int l = glGenLists(1);
# Line 704  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G Line 705  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G
705        }        }
706        return l;        return l;
707    }    }
708  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_startCompile  jf(void, startCompile)
709    (JNIEnv *, jclass, jint l, jint wid) {    (JNIEnv *, jclass, jint l, jint wid) {
710        DBG(dbg) << "Start list compilation "<<l<<"\n";        DBG(dbg) << "Start list compilation "<<l<<"\n";
711    
# Line 714  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 715  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
715        glNewList(l, GL_COMPILE);        glNewList(l, GL_COMPILE);
716        GLERR        GLERR
717    }    }
718  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_endCompile  jf(void, endCompile)
719    (JNIEnv *, jclass, jint, jint wid) {    (JNIEnv *, jclass, jint, jint wid) {
720        DBG(dbg) << "End list compilation\n";        DBG(dbg) << "End list compilation\n";
721        GLERR        GLERR
# Line 724  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 725  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
725        releaseWindow();        releaseWindow();
726    }    }
727    
728  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_compileCallGL  jf(void, compileCallGL)
729    (JNIEnv *env, jclass, jint l, jstring s) {    (JNIEnv *env, jclass, jint l, jstring s) {
730        std::string utf = jstr2stdstr(env, s);        std::string utf = jstr2stdstr(env, s);
731        DBG(dbg) << "got str\n";        DBG(dbg) << "got str\n";
# Line 732  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 733  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
733        DBG(dbg) << "called\n";        DBG(dbg) << "called\n";
734    }    }
735    
736  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteDisplayList  jf(void, deleteDisplayList)
737    (JNIEnv *, jclass, jint l) {    (JNIEnv *, jclass, jint l) {
738        DBG(dbg) << "Delete display list (XXX Might crash if contexts wrong)\n";        DBG(dbg) << "Delete display list (XXX Might crash if contexts wrong)\n";
739        glDeleteLists(l, 1);        glDeleteLists(l, 1);
740        DBG(dbg) << "Deleted display list\n";        DBG(dbg) << "Deleted display list\n";
741    }    }
742    
743  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1DisplayList_1call  jf(void, impl_1DisplayList_1call)
744    (JNIEnv *, jclass, jint l, jint w) {    (JNIEnv *, jclass, jint l, jint w) {
745        setWindow(w);        setWindow(w);
746        glCallList(l);        glCallList(l);
747        releaseWindow();        releaseWindow();
748  }  }
749    
750  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1DisplayList_1call0  jf(void, impl_1DisplayList_1call0)
751    (JNIEnv *, jclass, jint l) {    (JNIEnv *, jclass, jint l) {
752        glCallList(l);        glCallList(l);
753  }  }
# Line 754  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 755  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
755    
756  // ByteVector  // ByteVector
757  //  //
758  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_createByteVectorImpl  jf(jint, createByteVectorImpl)
759    (JNIEnv *, jclass, jint size) {    (JNIEnv *, jclass, jint size) {
760        ByteVector *vec = new ByteVector(size);        ByteVector *vec = new ByteVector(size);
761        DBG(dbg) << "Alloc byte vector "<<(int)vec<<"\n";        DBG(dbg) << "Alloc byte vector "<<(int)vec<<"\n";
762        return bytevectors.add(vec);        return bytevectors.add(vec);
763  }  }
764    
765  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteByteVector  jf(void, deleteByteVector)
766    (JNIEnv *, jclass, jint id) {    (JNIEnv *, jclass, jint id) {
767        DBG(dbg) << "Delete byte vector "<<(int)bytevectors[id]<<"\n";        DBG(dbg) << "Delete byte vector "<<(int)bytevectors[id]<<"\n";
768        bytevectors.remove(id);        bytevectors.remove(id);
769  }  }
770    
771  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1readFromBuffer  jf(void, impl_1ByteVector_1readFromBuffer)
772    (JNIEnv *env, jclass, jint id, jint winid, jstring buffer,    (JNIEnv *env, jclass, jint id, jint winid, jstring buffer,
773          jint x, jint y, jint w, jint h,          jint x, jint y, jint w, jint h,
774          jstring format, jstring type)          jstring format, jstring type)
# Line 790  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 791  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
791      releaseWindow();      releaseWindow();
792  }  }
793    
794  JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1drawPixels  jf(void, impl_1ByteVector_1drawPixels)
795    (JNIEnv *env, jclass, jint id, jint winid,    (JNIEnv *env, jclass, jint id, jint winid,
796          jint x, jint y, jfloat z, jint w, jint h,          jint x, jint y, jfloat z, jint w, jint h,
797          jstring format, jstring type)          jstring format, jstring type)
# Line 813  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G Line 814  JNIEXPORT void JNICALL Java_gzz_gfx_gl_G
814  }  }
815    
816    
817  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1get__II  jf(jint, impl_1ByteVector_1get__II)
818   (JNIEnv *env, jclass, jint id, jint ind) {   (JNIEnv *env, jclass, jint id, jint ind) {
819      return (*bytevectors[id])[ind];      return (*bytevectors[id])[ind];
820  }  }
821    
822  JNIEXPORT jbyteArray JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1get__I  jf(jbyteArray, impl_1ByteVector_1get__I)
823    (JNIEnv *env, jclass, jint id) {    (JNIEnv *env, jclass, jint id) {
824      int len = bytevectors[id]->size();      int len = bytevectors[id]->size();
825      jbyteArray arr = env->NewByteArray(len);      jbyteArray arr = env->NewByteArray(len);
# Line 826  JNIEXPORT jbyteArray JNICALL Java_gzz_gf Line 827  JNIEXPORT jbyteArray JNICALL Java_gzz_gf
827      return arr;      return arr;
828  }  }
829    
830  JNIEXPORT jintArray JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1getInts  jf(jintArray, impl_1ByteVector_1getInts)
831    (JNIEnv *env, jclass, jint id) {    (JNIEnv *env, jclass, jint id) {
832      int len = bytevectors[id]->size() / 4;      int len = bytevectors[id]->size() / 4;
833      jintArray arr = env->NewIntArray(len);      jintArray arr = env->NewIntArray(len);
# Line 835  JNIEXPORT jintArray JNICALL Java_gzz_gfx Line 836  JNIEXPORT jintArray JNICALL Java_gzz_gfx
836  }  }
837    
838    
839  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1shade  jf(jint, impl_1ByteVector_1shade)
840    (JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp,    (JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp,
841              jstring name, jobjectArray params) {              jstring name, jobjectArray params) {
842        setWindow();        setWindow();
# Line 857  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G Line 858  JNIEXPORT jint JNICALL Java_gzz_gfx_gl_G
858  }  }
859    
860    
861    jf(void, setDebugVar)
862      (JNIEnv *env, jclass, jstring name, jint value) {
863          std::string utf = jstr2stdstr(env, name);
864          Debug::var(utf.c_str()) = value;
865    }
866    
867    jf(jint, getDebugVar)
868      (JNIEnv *env, jclass, jstring name) {
869          std::string utf = jstr2stdstr(env, name);
870          int value = Debug::var(utf.c_str()) ;
871          return value;
872    }
873    
874    jf(jobjectArray, Java_gzz_gfx_gl_GL_getDebugVarNames)
875      (JNIEnv *env, jclass) {
876          vector<const char *> vec;
877          vec = Debug::getVarNames();
878          jclass strclass = env->FindClass("java/lang/String");
879          jobjectArray result = env->NewObjectArray(vec.size(),
880                                      strclass, 0);
881          for(unsigned i=0; i<vec.size(); i++)
882              env->SetObjectArrayElement(result, i,
883                              env->NewStringUTF(vec[i]));
884          return result;
885    }
886    
887    jf(jstring, getGLString)
888      (JNIEnv *env, jclass, jstring name) {
889          std::string utf = jstr2stdstr(env, name);
890          const char *value = CallGL::getString(utf.c_str()) ;
891          return env->NewStringUTF(value);
892    }
893    
894    jf(jfloatArray, getGLFloat)
895      (JNIEnv *env, jclass, jstring name) {
896          std::string utf = jstr2stdstr(env, name);
897          vector<float> vec = CallGL::getFloat(utf.c_str()) ;
898          jfloatArray result = env->NewFloatArray(vec.size());
899          env->SetFloatArrayRegion(result, 0, vec.size(), &vec[0]);
900          return result;
901    }
902    
903    jf(jfloatArray, getGLProgram)
904      (JNIEnv *env, jclass, jstring j_target, jstring j_name) {
905          std::string target = jstr2stdstr(env, j_target);
906          std::string name = jstr2stdstr(env, j_name);
907          vector<float> vec = CallGL::getProgram(target.c_str(), name.c_str()) ;
908          jfloatArray result = env->NewFloatArray(vec.size());
909          env->SetFloatArrayRegion(result, 0, vec.size(), &vec[0]);
910          return result;
911    }
912    
913    jf(jint, getGLProgrami)
914      (JNIEnv *env, jclass, jstring j_target, jint id, jstring j_name) {
915          GLenum target = tokenFromJstring(env, j_target);
916          GLenum name = tokenFromJstring(env, j_name);
917          glBindProgramARB(target, id);
918          GLint res;
919          glGetProgramivARB(target, name, &res);
920          glBindProgramARB(target, 0);
921          return res;
922    }
923    
924    jf(jfloatArray, getGLTexParameterFloat)
925      (JNIEnv *env, jclass, jstring target, jint tex, jstring name) {
926          std::string utf_target = jstr2stdstr(env, target);
927          std::string utf = jstr2stdstr(env, name);
928          vector<float> vec = CallGL::getTexParameterFloat(utf_target.c_str(), tex, utf.c_str());
929          jfloatArray result = env->NewFloatArray(vec.size());
930          env->SetFloatArrayRegion(result, 0, vec.size(), &vec[0]);
931          return result;
932    }
933    
934    jf(jfloatArray, getGLTexLevelParameterFloat)
935      (JNIEnv *env, jclass, jstring target, jint tex, jint level, jstring name) {
936          std::string utf_target = jstr2stdstr(env, target);
937          std::string utf = jstr2stdstr(env, name);
938          vector<float> vec = CallGL::getTexLevelParameterFloat(utf_target.c_str(), tex, level, utf.c_str()) ;
939          jfloatArray result = env->NewFloatArray(vec.size());
940          env->SetFloatArrayRegion(result, 0, vec.size(), &vec[0]);
941          return result;
942    }
943    
944    jf(jstring, getGLTokenString)
945      (JNIEnv *env, jclass, jint value) {
946          const char *str = CallGL::getTokenString(value) ;
947          return env->NewStringUTF(str);
948    }
949    
950    
951    
952    
953    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26