// (c) Tuomas J. Lukka package gzz.vob; import java.awt.*; import gzz.gfx.gl.GLCache; /** A vob which produces a small (about 3x3 pixel) rectangle at a specified place * with a specified color; * useful for testing VobCoorders. * For tests, an important feature is that the size of the rectangle is * constant in screen coordinates; scaling does not affect it. * This is most likely not useful for anything else. */ public class TestSpotVob extends Vob { public static final String rcsid = "$Id: TestSpotVob.java,v 1.1 2002/10/29 14:13:39 tjl Exp $"; float x, y, z; Color color = Color.white; Vob glrend; /** Create a white testspot. */ public TestSpotVob(float x, float y, float z) { this.x = x; this.y = y; this.z = z; } public void render(Graphics g, boolean fast, Vob.RenderInfo info1, Vob.RenderInfo info2) { Point i = new Point(); info1.xform(x, y, i); g.setColor(color); g.fillRect(i.x-1, i.y-1, 3, 3); } public int addToListGL(gzz.client.GraphicsAPI.Window win, int[] list, int curs, int coordsys1, int coordsys2) { if(glrend == null) { glrend = GLCache.getCallListCoorded( " PushAttrib CURRENT_BIT ENABLE_BIT \n" + " Disable TEXTURE_2D \n" + " Disable BLEND \n" + " PointSize 3 \n" + " Color 1 1 1 \n" + " Begin POINTS \n" + " Vertex %s %s %s \n" + " End \n" + " PopAttrib \n" ); } return glrend.addToListGL(win, list, curs, coordsys1, coordsys2); } }