/[libvob]/libvob/org/nongnu/libvob/gl/GL.java
ViewVC logotype

Diff of /libvob/org/nongnu/libvob/gl/GL.java

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

revision 1.25 by tjl, Sun Sep 28 13:02:17 2003 UTC revision 1.26 by tjl, Fri Oct 10 13:52:23 2003 UTC
# Line 69  public class GL { Line 69  public class GL {
69          }          }
70      }      }
71    
72      /** ATI drivers for the R300 family still have some serious bugs.      /** ATI Linux drivers for the R300 family still have some serious bugs.
73       * We have workarounds for some in place; this flag       * We have workarounds for some in place; this flag
74       * will enable them.       * will enable them.
75       * <p>       * <p>
# Line 364  public class GL { Line 364  public class GL {
364           * @param dimno The dimension (0=x, 1=y) to get.           * @param dimno The dimension (0=x, 1=y) to get.
365           */           */
366          public int getSize(int dimNo) { return getImageSize(getId(), dimNo); }          public int getSize(int dimNo) { return getImageSize(getId(), dimNo); }
367            public int getPixel(int offset) { return getImagePixel(getId(), offset); }
368          public Dimension getSize() {          public Dimension getSize() {
369              return new Dimension( getSize(0), getSize(1) );              return new Dimension( getSize(0), getSize(1) );
370          }          }
# Line 385  public class GL { Line 386  public class GL {
386      static private native int createImageImpl(String filename);      static private native int createImageImpl(String filename);
387      static private native void deleteImage(int i);      static private native void deleteImage(int i);
388      static private native int getImageSize(int id, int dimNo);      static private native int getImageSize(int id, int dimNo);
389        static private native int getImagePixel(int id, int offset);
390    
391    
392  //--------- Texture  //--------- Texture
# Line 392  public class GL { Line 394  public class GL {
394       * Here, id == directly the texture id.       * Here, id == directly the texture id.
395       */       */
396      static public class Texture extends NonRenderableJavaObject {      static public class Texture extends NonRenderableJavaObject {
397            /** Whether the destruction of this texture object
398             * should cause the underlying implementation texture
399             * object to be deleted.
400             */
401          boolean delReal;          boolean delReal;
402    
403          /** Create a texture object whose GL texture will not be deleted          /** Create a texture object whose GL texture will not be deleted
404           * upon the deletion of the Java object.           * upon the deletion of the Java object.
405           */           */
# Line 432  public class GL { Line 439  public class GL {
439          /** Call glGetCompressedTexImage.          /** Call glGetCompressedTexImage.
440           */           */
441          public byte[] getCompressedTexImage(int lod) {          public byte[] getCompressedTexImage(int lod) {
442              return impl_Texture_getCompressedTexImage(getId(), lod);              return impl_Texture_getCompressedTexImage(getId(), lod, null);
443            }
444    
445            /** Call glGetCompressedTexImage, with an array for the data.
446             */
447            public byte[] getCompressedTexImage(int lod, byte[] prearr) {
448                return impl_Texture_getCompressedTexImage(getId(), lod, prearr);
449          }          }
450    
451          public void getTexImage(int lod, String format, String type,          public void getTexImage(int lod, String format, String type,
# Line 447  public class GL { Line 460  public class GL {
460          public void compressedTexImage(int level,          public void compressedTexImage(int level,
461                      String internalFormat, int width, int height,                      String internalFormat, int width, int height,
462                          int border, byte[] data) {                          int border, byte[] data) {
463                compressedTexImage(level, internalFormat, width, height,
464                        border, data.length, data);
465            }
466            public void compressedTexImage(int level,
467                        String internalFormat, int width, int height,
468                            int border, int size, byte[] data) {
469              impl_Texture_compressedTexImage(getId(),              impl_Texture_compressedTexImage(getId(),
470                      level, internalFormat, width, height,                      level, internalFormat, width, height,
471                          border, data);                          border, size, data);
472            }
473    
474            public void compressedTexSubImage2D(int level,
475                        int xoffs, int yoffs, int width, int height,
476                        String format, int size, byte[] data) {
477                impl_Texture_compressedTexSubImage2D(getId(),
478                        level, xoffs, yoffs, width, height, format, size, data);
479          }          }
480    
481          /** Call glTexImage2D.          /** Call glTexImage2D.
# Line 566  public class GL { Line 592  public class GL {
592                      String target, int level,                      String target, int level,
593                      String internalFormat, int x, int y,                      String internalFormat, int x, int y,
594                      int w, int h, int border) ;                      int w, int h, int border) ;
595      static private native byte[] impl_Texture_getCompressedTexImage(int id, int lod);      static private native byte[] impl_Texture_getCompressedTexImage(int id, int lod, byte[] preArray);
596      static private native void impl_Texture_compressedTexImage(int id, int level, String internalFormat,      static private native void impl_Texture_compressedTexImage(int id, int level, String internalFormat,
597                      int width, int height, int border, byte[] data);                      int width, int height, int border, int size, byte[] data);
598        static private native void impl_Texture_compressedTexSubImage2D(int id, int level,
599                        int xoffs, int yoffs, int width, int height, String format, int size, byte[] data);
600      static private native void impl_Texture_getTexImage(int id,      static private native void impl_Texture_getTexImage(int id,
601                      int lod, String format, String type, byte[] array) ;                      int lod, String format, String type, byte[] array) ;
602    
603    // -------- IndirectTexture
604    
605        /** An indirect texture object. Like a pointer: can be set to
606         * point to any given real GL.Texture object.
607         * This object exists because it's apparently unhealthy to allocate and
608         * deallocate lots of textures in some OpenGL implementations, and we need
609         * a fixed set of textures that we keep switching with each other.
610         * On the implementation side, the value zero is used for a non-bound
611         * indirect texture.
612         */
613        static public class IndirectTexture extends NonRenderableJavaObject {
614            /** The real texture this indirect texture points to.
615             * May be null.
616             * This value is mirrored on the C++ side.
617             */
618            private GL.Texture texture;
619    
620            private IndirectTexture(int id, GL.Texture texture) {
621                super(id);
622                setTexture(texture);
623            }
624            protected void deleteObj() {
625                impl_IndirectTexture_delete(getId());
626            }
627    
628            /** Set the texture this indirect texture should point to.
629             */
630            public void setTexture(GL.Texture texture) {
631                this.texture = texture;
632                impl_IndirectTexture_setTexture(getId(),
633                            texture == null ? 0 : texture.getTexId());
634            }
635            /** Get the texture this indirect texture currently points to.
636             */
637            public GL.Texture getTexture() {
638                return texture;
639            }
640    
641            public int getIndirectTextureId() {
642                return getId();
643            }
644    
645        }
646    
647        static public IndirectTexture createIndirectTexture() {
648            return createIndirectTexture(null);
649        }
650        static public IndirectTexture createIndirectTexture(Texture initialValue) {
651            return new IndirectTexture(impl_IndirectTexture_create(),
652                                        initialValue);
653        }
654    
655        static private native int impl_IndirectTexture_create();
656        static private native int impl_IndirectTexture_setTexture(int id, int texid);
657        static private native int impl_IndirectTexture_delete(int id);
658    
659  // -------- FTFont  // -------- FTFont
660      /** A freetype font.      /** A freetype font.
661       * Not directly renderable - see GLFont for that.       * Not directly renderable - see GLFont for that.
# Line 763  public class GL { Line 847  public class GL {
847      /** An OpenGL display list.      /** An OpenGL display list.
848       */       */
849      static public class DisplayList extends NonRenderableJavaObject{      static public class DisplayList extends NonRenderableJavaObject{
850            private ArrayList depends;
851    
852          private DisplayList(int id) {          private DisplayList(int id) {
853              super(id);              super(id);
854          }          }
# Line 791  public class GL { Line 877  public class GL {
877          /** Call the display list in the default context.          /** Call the display list in the default context.
878           */           */
879          public void call() { GL.impl_DisplayList_call0(getId()); }          public void call() { GL.impl_DisplayList_call0(getId()); }
880    
881            /** Get the display list ID.
882             * For use, e.g., in nesting display lists.
883             * Note that you must ensure no GC will occur.
884             * Calling addDepend is recommended.
885             */
886            public int getDisplayListID() { return getId(); }
887    
888            /** Add a dependency.
889             * Adds an object that mustn't get garbage collected
890             * before this one.
891             */
892            public void addDepend(Object o) {
893                if(depends == null) depends = new ArrayList();
894                depends.add(o);
895            }
896      }      }
897    
898      /** Create a new, empty display list.      /** Create a new, empty display list.

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

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