package org.newdawn.slick.svg; import org.newdawn.slick.Color; import org.newdawn.slick.Graphics; import org.newdawn.slick.geom.Shape; import org.newdawn.slick.geom.ShapeRenderer; import org.newdawn.slick.geom.TexCoordGenerator; import org.newdawn.slick.opengl.TextureImpl; import org.newdawn.slick.opengl.renderer.Renderer; import org.newdawn.slick.opengl.renderer.SGL; /** * A very primtive implementation for rendering a diagram. This simply * sticks the shapes on the screen in the right fill and stroke colours * * @author kevin */ public class SimpleDiagramRenderer { /** The renderer to use for all GL operations */ protected static SGL GL = Renderer.get(); /** The diagram to be rendered */ public Diagram diagram; /** The display list representing the diagram */ public int list = -1; /** * Create a new simple renderer * * @param diagram The diagram to be rendered */ public SimpleDiagramRenderer(Diagram diagram) { this.diagram = diagram; } /** * Render the diagram to the given graphics context * * @param g The graphics context to which we should render the diagram */ public void render(Graphics g) { // last list generation if (list == -1) { list = GL.glGenLists(1); GL.glNewList(list, SGL.GL_COMPILE); render(g, diagram); GL.glEndList(); } GL.glCallList(list); TextureImpl.bindNone(); } /** * Utility method to render a diagram in immediate mode * * @param g The graphics context to render to * @param diagram The diagram to render */ public static void render(Graphics g, Diagram diagram) { for (int i=0;i