2003/10/01 21:44:33
[org.ibex.core.git] / src / org / xwt / plat / OpenGL.java
index 8f25506..5367cb6 100644 (file)
@@ -30,8 +30,9 @@ abstract class OpenGL {
     public void init() throws NotSupportedException {
         natInit();
         float v = parseVersion(version);
+        // FEATURE: enable linear filtering for OpenGL >= 1.2
         // If we disable linear filtering (and therefor GL_CLAMP_TO_EDGE) we could probably get by with less
-        if(v < 1.2) throw new NotSupportedException("OpenGL 1.2 or greater is required. (you have: " + version +" - " + v + ")");
+        if(v < 1.1) throw new NotSupportedException("OpenGL 1.1 or greater is required. (you have: " + version +" - " + v + ")");
         if(pretendToBeACrappyVideoCard) {
             maxTexSize = 512;
             maxRectTexSize = 0;
@@ -51,7 +52,7 @@ abstract class OpenGL {
         public NotSupportedException(String s) { super(s); }
     }
 
-    public static abstract class GLDoubleBuffer extends DoubleBuffer {
+    public static abstract class GLPixelBuffer extends PixelBuffer {
         protected int width;
         protected int height;
         public int getWidth() { return width; }
@@ -59,7 +60,7 @@ abstract class OpenGL {
         
         private boolean glScissorEnabled = false;
         
-        public GLDoubleBuffer(int width, int height) {
+        public GLPixelBuffer(int width, int height) {
             this.width = width;
             this.height = height;
         }
@@ -73,13 +74,17 @@ abstract class OpenGL {
         
         public native void setClip(int x, int y, int x2, int y2);
         public native void resetClip();
-        public native void fillRect(int x, int y, int x2, int y2, int color);
         public native void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color);
             
         public void drawString(String font, String text, int x, int y, int color) {
             //System.out.println("drawString(): " + text);
         }
         
+        //public native void drawPictureAlphaOnly(Picture source, int dx1, int dy1, int dx2, int dy2,
+        //int sx1, int sy1, int sx2, int sy2, int rgb);
+        public void drawPictureAlphaOnly(Picture source, int dx1, int dy1, int dx2, int dy2,
+            int sx1, int sy1, int sx2, int sy2, int rgb) { }
+
         public void drawPicture(org.xwt.Picture source, int x, int y) {
             activateContext();
             GLPicture p = (GLPicture) source;
@@ -99,7 +104,6 @@ abstract class OpenGL {
     }
         
     public Picture createPicture(int[] data, int w, int h) {
-        if(w*h != data.length) throw new Error("w*h != data.length");
         if(rectangularTextures && w <= maxRectTexSize && h <= maxRectTexSize) new RectGLPicture(data,w,h,this);
         if(w <= maxTexSize && h <= maxTexSize) return new SquareGLPicture(data,w,h,this);
         return new MosaicGLPicture(data,w,h,this);
@@ -109,7 +113,7 @@ abstract class OpenGL {
     public void deleteTexture(final int tex) {
         // CHECKME: Is this safe to do from finalize()?
         // natDeleteTexture MUST be run from the message queue thread
-        MessageQueue.add(new Message() { public void perform() {
+        Message.Q.add(new Message() { public void perform() {
             natDeleteTexture(tex);
         }});
     }