X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fplat%2FOpenGL.java;h=5b9590afd69fda6408c10307f6c893b74a1eebff;hp=0d5bf18b889f27a2005ebe34a1db2d4c2c1b0dae;hb=297fdbde87e6db4732448a0950d1141c7265c169;hpb=ef73cbdf9c1fc30f4bc59453c7e759e0a507580f diff --git a/src/org/ibex/plat/OpenGL.java b/src/org/ibex/plat/OpenGL.java index 0d5bf18..5b9590a 100644 --- a/src/org/ibex/plat/OpenGL.java +++ b/src/org/ibex/plat/OpenGL.java @@ -2,9 +2,11 @@ // Author: Brian Alliet package org.ibex.plat; -import org.ibex.*; import org.ibex.js.*; import org.ibex.util.*; +import org.ibex.graphics.*; +import org.ibex.core.*; +import org.ibex.net.*; abstract class OpenGL { static final boolean pretendToBeACrappyVideoCard = false; @@ -53,7 +55,7 @@ abstract class OpenGL { public NotSupportedException(String s) { super(s); } } - public static abstract class GLPixelBuffer extends PixelBuffer { + public static abstract class GLPixelBuffer implements PixelBuffer { protected int width; protected int height; public int getWidth() { return width; } @@ -61,6 +63,9 @@ abstract class OpenGL { private boolean glScissorEnabled = false; + // FIXME: HUGE HACK! + public GLPixelBuffer() { width = 500; height = 500; } + public GLPixelBuffer(int width, int height) { this.width = width; this.height = height; @@ -76,13 +81,18 @@ abstract class OpenGL { public native void setClip(int x, int y, int x2, int y2); public native void resetClip(); 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 void drawLine(int x1, int y1, int x2, int y2, int color) { + // FIXME + fillTrapezoid(x1, x1, y1, x2, x2, y2, color); } - public void drawGlyph(org.ibex.Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) { - drawPicture_(((org.ibex.Platform.DefaultGlyph)source).getPicture(), dx, dy, cx1, cy1, cx2, cy2, rgb); + public void stroke(Polygon p, int color) { p.stroke(this, color); } + public native void natFill(Polygon p, int color); + public void fill(Polygon p, Paint paint) { natFill(p, ((Paint.SingleColorPaint)paint).color); } + + public void drawGlyph(org.ibex.graphics.Font.Glyph source, int dx, int dy, + int cx1, int cy1, int cx2, int cy2, int rgb, int pc) { + drawPicture_(((org.ibex.plat.Platform.DefaultGlyph)source).getPicture(), dx, dy, cx1, cy1, cx2, cy2, rgb); } public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) { drawPicture_(source, dx, dy, cx1, cy1, cx2, cy2, 0xffffffff); @@ -127,13 +137,13 @@ abstract class OpenGL { GLPicture realPicture = null; } - public Font.Glyph _createGlyph(org.ibex.Font f, char c) { return new org.ibex.Platform.DefaultGlyph(f, c); } + public Font.Glyph _createGlyph(org.ibex.graphics.Font f, char c) { return new org.ibex.plat.Platform.DefaultGlyph(f, c); } private native void natDeleteTexture(int tex); public void deleteTexture(final int tex) { // CHECKME: Is this safe to do from finalize()? // natDeleteTexture MUST be run from the message queue thread - Scheduler.add(new Scheduler.Task() { public void perform() { natDeleteTexture(tex); }}); + Scheduler.add(new Callable() { public Object run(Object o) { natDeleteTexture(tex); return null; }}); } private static abstract class GLPicture {