Package com.jogamp.opengl.util.awt

Examples of com.jogamp.opengl.util.awt.TextureRenderer.createGraphics()


   * @return
   */
  public static TextureRenderer makeText(String text) {
    // create texture for the text
    TextureRenderer textRenderer = new TextureRenderer(1, 3, false);
    Graphics2D g2d = textRenderer.createGraphics();
    FontRenderContext frc = g2d.getFontRenderContext();
    Font f = new Font("Arial", Font.BOLD, 18);
    String s = new String(text);
    TextLayout tl = new TextLayout(s, f, frc);
    // get the necessary size for the text to be rendered
View Full Code Here


    int width = (int) bounds.getWidth() + 6;
    int height = (int) bounds.getHeight() + 6;
    // create a new texture renderer with the exact correct width and height.
    textRenderer = new TextureRenderer(width, height, true);
    textRenderer.setSmoothing(true);
    g2d = textRenderer.createGraphics();
    g2d.setColor(Color.white);
    //coordinate are inversed: 0:0 is top-left.
    tl.draw(g2d, 3, height - 3);

    textRenderer.markDirty(0, 0, width, height);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.