/* TestSpotVob.java * * Copyright (c) 2002, Tuomas J. Lukka * * You may use and distribute under the terms of either the GNU Lesser * General Public License, either version 2 of the license or, * at your choice, any later version. Alternatively, you may use and * distribute under the terms of the XPL. * * See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of * the licenses. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README * file for more details. * */ /* * Written by Tuomas J. Lukka */ package gzz.vob.vobs; import 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/11/02 01:23:46 benja 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 "+x+" "+y+" "+z+" \n" + " End \n" + " PopAttrib \n" ); } return glrend.addToListGL(win, list, curs, coordsys1, coordsys2); } }