当前位置: 首页>>代码示例>>Java>>正文


Java TextRenderer.begin3DRendering方法代码示例

本文整理汇总了Java中com.jogamp.opengl.util.awt.TextRenderer.begin3DRendering方法的典型用法代码示例。如果您正苦于以下问题:Java TextRenderer.begin3DRendering方法的具体用法?Java TextRenderer.begin3DRendering怎么用?Java TextRenderer.begin3DRendering使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jogamp.opengl.util.awt.TextRenderer的用法示例。


在下文中一共展示了TextRenderer.begin3DRendering方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: annotate

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
@Override
    public void annotate(GLAutoDrawable drawable) {
        GL2 gl = drawable.getGL().getGL2();
//             if (textRenderer == null) {
        textRenderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, 24), true, true);
        textRenderer.setColor(Color.blue);

//            }
        gl.glColor3f(0, 0, 1);
        gl.glLineWidth(2);
        final float x = chip.getSizeX() * .4f, y = (chip.getSizeY()) * .9f;
        textRenderer.begin3DRendering();
        String s = String.format("TimestampCalibrator: ts-wall: %6dms, ppmTsTooFast: %6.0f", driftTsMinusClockMs, ppmTimestampTooFastError);
        Rectangle2D r = textRenderer.getBounds(s); // width and height in pixels with scale=1
        // set scale so that width fills fraction of 
        final float scale = (float) (0.7f * (float) chip.getSizeX() / r.getWidth());
        textRenderer.draw3D(s, (float) (x - scale * r.getWidth() / 2), (float) (y - scale * r.getHeight() / 2), 0, scale);
        textRenderer.end3DRendering();
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:20,代码来源:TimestampCalibrator.java

示例2: drawRadialGridText

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
private static void drawRadialGridText(GL2 gl, ArrayList<GridLabel> labels, double size, float[] labelPos) {
    gl.glDisable(GL2.GL_CULL_FACE);

    float fuzz = 0.75f;
    for (float rsize : labelPos) {
        TextRenderer renderer = GLText.getRenderer((int) (fuzz * rsize * size));
        float textScaleFactor = textScale / renderer.getFont().getSize2D();
        renderer.begin3DRendering();
        for (GridLabel label : labels) {
            renderer.draw3D(label.txt, rsize * label.x, rsize * label.y, 0, fuzz * rsize * textScaleFactor);
        }
        renderer.end3DRendering();
    }

    gl.glEnable(GL2.GL_CULL_FACE);
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:17,代码来源:GridLayer.java

示例3: displayStatusChangeText

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
/** shows the status change display centered over the image
 * 
 * @param drawable the OpenGL context
 */
protected void displayStatusChangeText(GLAutoDrawable drawable) {
    if (statusChangeString == null) {
        return;
    }
    long now = System.currentTimeMillis();
    if ((now - statusChangeStartTimeMillis) > statusChangeDisplayTimeMillis) {
        statusChangeString = null;
        return;
    }
    GL2 gl = drawable.getGL().getGL2();
    TextRenderer renderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, 24), true, true);
    renderer.setColor(Color.white);
    try {
        renderer.begin3DRendering();
        boolean first = true;

        Rectangle2D r = renderer.getBounds(statusChangeString);
        float scale = .5f;
        float ypos = (float) (chip.getSizeY()/2 - r.getHeight() * scale);
        float xpos = (float) (chip.getSizeX()/2 - r.getWidth()/2 * scale);
        renderer.draw3D(statusChangeString, xpos, ypos, 0, scale);
        renderer.end3DRendering();
    } catch (GLException e) {
        log.warning("caught " + e + " when trying to render text into the current OpenGL context");
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:31,代码来源:DisplayMethod.java

示例4: drawGridText

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
private void drawGridText(GL2 gl, int size) {
    TextRenderer renderer = GLText.getRenderer(size);
    // the scale factor has to be divided by the current font size
    float textScaleFactor = textScale / renderer.getFont().getSize2D();

    renderer.begin3DRendering();

    gl.glDisable(GL2.GL_CULL_FACE);
    for (GridLabel label : latLabels) {
        renderer.draw3D(label.txt, label.x, label.y, 0, textScaleFactor);
    }
    renderer.flush();
    gl.glEnable(GL2.GL_CULL_FACE);

    for (GridLabel lonLabel : lonLabels) {
        gl.glPushMatrix();
        {
            gl.glTranslatef(lonLabel.x, 0, lonLabel.y);
            gl.glRotatef(lonLabel.theta, 0, 1, 0);

            renderer.draw3D(lonLabel.txt, 0, 0, 0, textScaleFactor);
            renderer.flush();
        }
        gl.glPopMatrix();
    }
    renderer.end3DRendering();
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:28,代码来源:GridLayer.java

示例5: perspectiveText

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
/**
 * Draws a string in perspective in the current color, with the given font, at the given position
 * 
 * @param string
 *            the string to draw
 * @param font
 *            the font to use
 * @param x,y,z
 *            the coordinates
 * @param scale
 *            the scale to apply
 */
public void perspectiveText(final String string, final Font font, final double x, final double y, final double z) {
	final TextRenderer r =
			textRendererCache.get(font.getName(), font.getSize() * (int) layerScalingFactor, font.getStyle());
	if (r == null) { return; }
	r.setUseVertexArrays(false);

	if (getCurrentColor() != null)
		r.setColor(getCurrentColor());
	final float scale = 1f / (float) (viewHeight / getWorldHeight());
	r.begin3DRendering();
	r.draw3D(string, (float) x, (float) y, (float) (z + currentZTranslation), scale);
	r.flush();
	r.end3DRendering();
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:27,代码来源:OpenGL.java

示例6: DrawNode

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
public void DrawNode(int base, HeatNode lum, GL2 gl) {
	
	double [] color = lum.getBGColor();
	double opacity = lum.getOpacity();

	// Draw the background
	gl.glColor4d (color[0], color[1], color[2], opacity);
	//Painter.DrawHexagon(GL2.GL_POLYGON, 0, 0, base, gl);

	// Draw the graphical hexagon
	if (lum.getSelected() == true)
		Painter.DrawImageHex(TexturePool.get("hexagon2"), GL2.GL_DECAL, 0.0, 0.0, 2 * base / 512.0, 0, opacity, gl);
	else
		Painter.DrawImageHex(TexturePool.get("hexagon1"), GL2.GL_DECAL, 0.0, 0.0, 2 * base / 512.0, 0, opacity, gl);

	// Draw the server image
	int imageSize = 200;
	gl.glColor4d (0.0, 0.0, 0.0, opacity);
	if (lum.getSelected() == true)
		Painter.DrawImageHex (TexturePool.get(lum.getTexture()), GL2.GL_BLEND, 0.0, 0.0, imageSize / 512.0, 90.0, opacity, gl);
	else
		Painter.DrawImageHex (TexturePool.get(lum.getTexture()), GL2.GL_BLEND, 0.0, 0.0, imageSize / 512.0, 0.0, opacity, gl);

	// Write the name of the node
	TextRenderer renderer = TextRendererPool.get("basic");
	renderer.begin3DRendering();
		renderer.setSmoothing(true);
		renderer.setUseVertexArrays(true);
		double [] bgcol = lum.getBGColor();
		if (bgcol[0] + bgcol[1] + bgcol[2] < 1.5)
			renderer.setColor (1.0f, 1.0f, 1.0f, (float) opacity);
		else
			renderer.setColor (0.0f, 0.0f, 0.0f, (float) opacity);
		
		Rectangle2D noob = renderer.getBounds(lum.GetName());
		
		float scale = 1.0f;
		
		if (noob.getWidth() > base)
			scale = 0.7f;
		
		int xx = (int) (-scale * noob.getWidth() / 2);
		int yy = (int) (-imageSize / 2 - scale * noob.getHeight() - 30);
		renderer.draw3D (lum.GetName(), xx, yy, 1.0f, scale);
		
		noob = renderer.getBounds(lum.maxProto);
		xx = (int) (-noob.getWidth() / 2);
		yy = (int) (+imageSize / 2 + 30);
		renderer.draw(lum.maxProto, xx, yy);

	renderer.end3DRendering();
}
 
开发者ID:ryft,项目名称:NetVis,代码行数:53,代码来源:MapPainter.java

示例7: StartRend

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
public static void StartRend(String name, GL2 gl) {
	TextRenderer renderer = renderers.get(name);
	renderer.begin3DRendering();
	renderer.setSmoothing(true);
	renderer.setUseVertexArrays(true);
}
 
开发者ID:ryft,项目名称:NetVis,代码行数:7,代码来源:TextRendererPool.java


注:本文中的com.jogamp.opengl.util.awt.TextRenderer.begin3DRendering方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。