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


Java TextRenderer.flush方法代码示例

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


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

示例1: paint

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
@Override
public void paint(){
	// Compute maximum width of text we're going to draw
	TextRenderer textRenderer = new TextRenderer(new Font(Font.SERIF,0 , 18));
	
    int maxTextWidth = (int) textRenderer.getBounds(this.text).getWidth();
    maxTextWidth = Math.min(maxTextWidth+10,size.width);
	
	GL2 gl=glContext.getGL2();
	gl.glClear(GL.GL_COLOR_BUFFER_BIT);
	gl.glPolygonMode (GL2.GL_FRONT, GL2.GL_LINE_STRIP);
    gl.glColor3f(0.5f, 0.5f, 0.5f);

    gl.glBegin(GL2.GL_LINE_STRIP);
    gl.glVertex2i( this.posx,this.posy);							//x1,y1
    gl.glVertex2i( this.posx+maxTextWidth,this.posy );				//x2,y1
    gl.glVertex2i( this.posx+maxTextWidth,this.posy +size.height); 	//x2,y2 
    gl.glVertex2i( this.posx,this.posy+size.height);				//x1,y2
    gl.glVertex2i( this.posx,this.posy);	
    gl.glEnd( );
    
    
    GLDrawable draw=gl.getGL().getContext().getGLDrawable();
	textRenderer.beginRendering(draw.getWidth(),draw.getHeight());
	textRenderer.setColor(Color.WHITE);
	textRenderer.setSmoothing(true);
	textRenderer.draw(this.text,(int)posx,(int)posy+5); //text and position
	textRenderer.flush();
	textRenderer.endRendering();
	
	gl.glFlush();
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:33,代码来源:GLButton.java

示例2: 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

示例3: 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

示例4: perspectiveOrthoText

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
public void perspectiveOrthoText(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.beginRendering(1, 1);
	r.draw3D(string, (float) x, (float) y, (float) z, scale);
	r.flush();
	r.endRendering();
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:15,代码来源:OpenGL.java

示例5: FinishRend

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


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