From: Sven G. <sgo...@ja...> - 2002-06-13 14:02:16
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday 08 June 2002 22:32, Robert Voigt wrote: > Hi, > > I have a subclass of GLAnimCanvas. It does all the usual stuff and it > works. I thought it might be a good idea to do the actual drawing > (everything from glBegin() to glEnd() ) in native code to speed it up. In > my case I get the arrays with the vertices and colors from the native side > anyway. > > So I just use the subclass of GLAnimCanvas to set up GL, and call a native > method in display(). It works, and it even displays different things in > different canvases if I tell it to. Why does it work? Am I just doing what > GL4Java would do otherwise (calling native methods)? Why is GL not confused > about where the drawing commands come from? And does it make sense? > well, the curretn gl context is being used, even in your native code, if you do not change the gl context. your native code runs in the same native thread, as the java methods would do. and yes, the gl calls are native ones, so it gives you nearly _no_ speed enhancements (may be 1-5%) just to group a couple of gl calls in a native proprietary function. also - your application ain't compatible anymore, meaning you must provide a native dynamic library for all plattforms where you want to see your application running. this effort in porting gl4java to many plattfroms and to provide binaries are the most stress factors within our development. e.g. we have to provide / specificate functionality which must be avaiable on all the OS / GL implementations etc. so IMHO it makes no sense to encapsulate some functionality within native methods. this is true, especially since jdk1.4's NIO Buffers - - jdk 1.4 with its hotspot vm is a high performance system, which gives us about 90% of native speed for applications on modern cpu's (>= 1.2 GHz). of course this depends on the data management (copy it only once, or many times - etc.). i hope this is usefull. look at kenneth's (and my) JavaOne 2002 demo papers .. (search at sun's) cheers, sven - -- health & wealth mailto:sgo...@ja... www : http://www.jausoft.com ; pgp: http://www.jausoft.com/gpg/ voice : +49-521-2399440 ; fax : +49-521-2399442 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9CKXYHdOA30NoFAARAorpAJ9wlclXPlLIlZ/cWH/+/EDCQogYHQCfdLWe UFHtnbl/qom7pYCAXrVjLQY= =hdV/ -----END PGP SIGNATURE----- |