gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gzz/gfx/gl GL.java


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/gzz/gfx/gl GL.java
Date: Mon, 23 Sep 2002 05:00:14 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/09/23 05:00:14

Modified files:
        gzz/gfx/gl     : GL.java 

Log message:
        Doc a bit

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GL.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gzz/gzz/gfx/gl/GL.java
diff -c gzz/gzz/gfx/gl/GL.java:1.1 gzz/gzz/gfx/gl/GL.java:1.2
*** gzz/gzz/gfx/gl/GL.java:1.1  Mon Sep 23 04:24:25 2002
--- gzz/gzz/gfx/gl/GL.java      Mon Sep 23 05:00:14 2002
***************
*** 33,39 ****
   */
  public class GL {
      public static boolean dbg = false;
-     private static void p(String s) { if(dbg) System.out.println(s); }
      private static void pa(String s) { System.err.println(s); }
  
      private static native int init(int debug);
--- 33,38 ----
***************
*** 48,58 ****
--- 47,62 ----
            libLoaded = true;
        }
      }
+ 
+     /** Init the library - to be called once during startup.
+      */
      public static void init() {
        loadLib();
        init(1);
      }
  
+     /** An interface to which GL provides events.
+      */
      public interface EventHandler {
        int PRESS = 1;
        int MOTION = 2;
***************
*** 65,76 ****
        void timeout(int id);
      }
  
!     public interface Ticker {
!       boolean tick();
!     }
! 
      public static final int RENDERABLE0 = 0x0800000;
      public static final int RENDERABLE1 = 0x1000000;
      public static final int RENDERABLE2 = 0x2000000;
  
      /** The Java proxy for a C++ object.
--- 69,84 ----
        void timeout(int id);
      }
  
!     /** Constant for the int array to be passed to
!      * C++, or'ed together with the ID, indicating
!      * a zero-argument renderable.
!      */
      public static final int RENDERABLE0 = 0x0800000;
+     /** See RENDERABLE0. 
+      */
      public static final int RENDERABLE1 = 0x1000000;
+     /** See RENDERABLE0. 
+      */
      public static final int RENDERABLE2 = 0x2000000;
  
      /** The Java proxy for a C++ object.
***************
*** 78,83 ****
--- 86,93 ----
      static public abstract class JavaObject extends gzz.vob.Vob {
        private int id = 0;
        JavaObject(int id) { super(); this.id = id; }
+       /** During garbage collection: destroy the C++ object associated with 
this object.
+        */
        public void finalize() {
            if(this.dbg) pa("Finalizing "+this+" "+id);
            if(id != 0) throw new Error("Zero id object!");
***************
*** 89,98 ****
--- 99,116 ----
                            RenderInfo info1,
                            RenderInfo info2
                            )  { }
+       /** Delete the C++ object associated with this proxy.
+        */
        protected abstract void deleteObj();
+       /** Get the C++ integer id associated with this object.
+        */
        protected int getId() { return id; }
      }
  
+     /** A Java object which is not supposed to be placed on display lists.
+      * This is here because Vob is a class, not an interface and
+      * we don't want to implement JavaObject twice.
+      */
      static public abstract class NonRenderableJavaObject extends JavaObject {
        NonRenderableJavaObject(int id) { super(id); }
        public int addToListGL(GraphicsAPI.Window win, int[] list, int cur, int 
cs1, int cs2) {
***************
*** 192,223 ****
--- 210,259 ----
      static private native void deleteRenderable2(int id);
  
  //--------- Window
+     /** An on-screen GLX window into which graphics can be drawn.
+      */
      final static public class Window extends NonRenderableJavaObject {
  
        private Window(int id) { super(id); }
  
        protected void deleteObj() { deleteWindow(getId()); }
  
+       // XXX ???
        public void repaint() { GL.repaintWindow(getId()); }
  
+       /** Call the EventHandler.timeout(id) with the given id,
+        * after at least ms milliseconds have passed.
+        */
        public void addTimeout(int ms, int id) {
            addTimeoutWindow(getId(), ms, id);
        }
  
+       /** Get the current bounds of the window on screen.
+        */
        public Rectangle getBounds() {
            Rectangle rect = new Rectangle();
            getWindowSize(getId(), rect);
            return rect;
        }
  
+       /** Set this window to be the current OpenGL context.
+        */
        public void setCurrent() { impl_Window_setCurrent(getId()); }
+       /** Release this window from being the current OpenGL context.
+        */
        public void release() { impl_Window_release(getId()); }
  
+       /** Move the upper left corner of the window to the given coordinates.
+        */
        public void move(int x, int y) { impl_Window_move(getId(), x, y); }
+       /** Resize the window.
+        */
        public void resize(int w, int h) { impl_Window_resize(getId(), w, h); }
      }
      final private static Window defaultWindow = new Window(-1);
  
+     /** Create a new window.
+      */
      static public Window createWindow(int x, int y, int w, int h, 
EventHandler eh) {
        return new Window(createWindowImpl(x, y, w, h, eh));
      }
***************
*** 236,248 ****
      static private native void impl_Window_resize(int id, int w, int h);
  
  //--------- Image
      static public class Image extends NonRenderableJavaObject {
        private Image(int id) { super(id); }
        protected void deleteObj() { deleteImage(getId()); }
!       int getSize(int dimNo) { return getImageSize(getId(), dimNo); }
      }
  
!     /** THIS METHOD IS A SEVERE SECURITY HOLE AND WILL BE REMOVED.
       * Exploit: load something that the image loader library doesn't like...
       * Need to work out how this should properly interact with mediaserver.
       */
--- 272,294 ----
      static private native void impl_Window_resize(int id, int w, int h);
  
  //--------- Image
+     /** A buffer on the C++ side, containing a single image.
+      */
      static public class Image extends NonRenderableJavaObject {
        private Image(int id) { super(id); }
        protected void deleteObj() { deleteImage(getId()); }
!       /** Get the size of this Image.
!        * @param dimno The dimension (0=x, 1=y) to get.
!        */
!       public int getSize(int dimNo) { return getImageSize(getId(), dimNo); }
!       public Dimension getSize() {
!           return new Dimension( getSize(0), getSize(1) );
!       }
      }
  
!     /** Create a new image from the prescribed file.
!      * THIS METHOD IS A SEVERE SECURITY HOLE AND WILL BE REMOVED OR ADJUSTED
!      * TO USE A SECURITY MANAGER OR SO.
       * Exploit: load something that the image loader library doesn't like...
       * Need to work out how this should properly interact with mediaserver.
       */
***************
*** 277,291 ****
--- 323,345 ----
      static public class TexRect extends NonRenderableJavaObject {
        private TexRect(int id) { super(id); }
        protected void deleteObj() { deleteImage(getId()); }
+       /** Get the OpenGL texture id in which this texture is stored.
+        */
        public int getTexId() {
            return getTexRectTexID(getId());
        }
+       /** Get a texture coordinate transformed to within the rectangle.
+        * @param coordInd 0=x, 1=y
+        * @param s The coordinate to transform.
+        */
        public double getTexCoord(int coordInd, double c) {
            return getTexRectTexCoord(getId(), coordInd, c);
        }
  
      }
  
+     /** Create a new TexRect by loading the given image into a mosaic tile.
+      */
      static public TexRect createTexRect(Image img) {
        return new TexRect(createTexRectImpl(img.getId()));
      }
***************
*** 296,328 ****
                int coordInd, double c);
  
  //--------- Texture
!     /** A texture object.
       * Here, id == directly the texture id.
       */
      static public class Texture extends NonRenderableJavaObject {
        private Texture(int id) { super(id); }
        protected void deleteObj() { impl_deleteTexture(getId()); }
        public int getTexId() { return getId(); }
        public int shade(int w, int h, int d, int comps, 
                String internalFormat, String format,
                String shaderName, String[] params) {
            return impl_Texture_shade(getId(), w, h, d, comps, internalFormat, 
format,
                shaderName, params);
        }
        public void loadNull2D(int level, 
                        String internalFormat, int w, int h, 
                        int border, String format, String type) {
            impl_Texture_loadNull2D(getId(), 
                        level, internalFormat, w, h, border, format, type);
        }
        public void loadSubImage(int level, Image img, int xoffs, int yoffs) {
            impl_Texture_loadSubImage(getId(), level, img.getId(), xoffs, 
yoffs);
        }
!       public void downsampleInto(Texture into, String target, int level, 
String internalFormat, String transferformat) {
!           impl_Texture_downsampleInto(getId(), into.getId(), target, level,
                    internalFormat, transferformat);
        }
      }
      static public Texture createTexture() { 
        return new Texture(impl_createTexture());
      }
--- 350,407 ----
                int coordInd, double c);
  
  //--------- Texture
!     /** A texture object. Represents a single OpenGL texture object.
       * Here, id == directly the texture id.
       */
      static public class Texture extends NonRenderableJavaObject {
        private Texture(int id) { super(id); }
        protected void deleteObj() { impl_deleteTexture(getId()); }
+ 
+       /** Get the OpenGL texture id of this texture.
+        */
        public int getTexId() { return getId(); }
+ 
+       /** Call libtexture to create the image into this texture object.
+        */
        public int shade(int w, int h, int d, int comps, 
                String internalFormat, String format,
                String shaderName, String[] params) {
            return impl_Texture_shade(getId(), w, h, d, comps, internalFormat, 
format,
                shaderName, params);
        }
+ 
+       /** Load a NULL pointer to the texture, which clears the image
+        * and sets the mip maps.
+        */
        public void loadNull2D(int level, 
                        String internalFormat, int w, int h, 
                        int border, String format, String type) {
            impl_Texture_loadNull2D(getId(), 
                        level, internalFormat, w, h, border, format, type);
        }
+ 
+       /** Load an image into a part of this texture.
+        */
        public void loadSubImage(int level, Image img, int xoffs, int yoffs) {
            impl_Texture_loadSubImage(getId(), level, img.getId(), xoffs, 
yoffs);
        }
! 
!       /** Copy this texture into the given texture.
!        * This function can be used for downsampling by copying from a 
non-zero level 
!        * @param into The texture to copy into
!        * @param levelFrom The mipmap level from which to copy. Note that the 
texture
!        *              is always copied TO level 0.
!        * @param internalFormat The internalFormat to use in the texture into.
!        * @param transferformat The format to use for the transfer.
!        */
!       public void downsampleInto(Texture into, String target, int levelFrom, 
String internalFormat, String transferformat) {
!           impl_Texture_downsampleInto(getId(), into.getId(), target, 
levelFrom,
                    internalFormat, transferformat);
        }
      }
+ 
+     /** Create a new OpenGL texture object.
+      */
      static public Texture createTexture() { 
        return new Texture(impl_createTexture());
      }




reply via email to

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