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


Java TextRenderer.endRendering方法代码示例

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


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

示例1: annotate

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {         //shows the class in the jAER window
    if ((drawable == null) || (chip.getCanvas() == null) || !classifyEvents || model == null) {
        return;
    }
    titleRenderer = new TextRenderer(new Font("Helvetica", Font.PLAIN, 40));
    Rectangle2D bounds = titleRenderer.getBounds("Unkown");
    titleArea = new Rectangle((int) bounds.getWidth(), (int) bounds.getHeight());
    GL2 gl = drawable.getGL().getGL2();
    gl.glColor3f(1, 1, 1);
    gl.glRasterPos3f(10, 10, 0);
    titleRenderer.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
    titleRenderer.setColor(Color.WHITE);
    titleRenderer.draw(String.format("Class: %d", labeledClass), titleArea.x, titleArea.y);
    titleRenderer.endRendering();
    gl.glPushMatrix();
    gl.glLoadIdentity();
    gl.glTranslatef(drawable.getSurfaceWidth() / 2, drawable.getSurfaceHeight() / 2, 0);
    gl.glColor3f(1, 1, 1);
    float w = drawable.getSurfaceWidth() * lastdot * 5;
    gl.glRectf(0, -10, w, 10);
    gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:24,代码来源:CochleaSVMTwoEars.java

示例2: renderStarInfo

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
public void renderStarInfo(Star selectedStar, Observer obs, Rectangle2D window, GL2 gl){
    TextRenderer titleRenderer = new TextRenderer(new Font("SansSerif", Font.BOLD, 26));
    titleRenderer.setColor(0.051f, 0.596f, 0.729f, 1f);
    titleRenderer.beginRendering((int)window.getWidth(), (int)window.getHeight());
    titleRenderer.draw("HIP " + selectedStar.getHipparcos(), 0, (int)window.getHeight() - 30);
    titleRenderer.endRendering();

    TextRenderer infoRenderer = new TextRenderer(new Font("SansSerif", Font.BOLD, 15));
    infoRenderer.setColor(0.141f, 0.784f, 0.941f, 1f);
    infoRenderer.beginRendering((int)window.getWidth(), (int)window.getHeight());
    infoRenderer.draw("Magnitude: " + selectedStar.getMagnitude(), 0, (int)window.getHeight() - 55);

    String bvString = String.format("B-V Color Index %.2f", selectedStar.getBVMagnitude());
    infoRenderer.draw(bvString, 0, (int) (window.getHeight() - 75));

    EquatorialCoordinates eq = selectedStar.getEquatorialCoordinates();
    String raString = Utils.rad2String(eq.getRightAscension(), false, true);
    String decString = Utils.rad2String(eq.getDeclination(), false, false);
    infoRenderer.draw("RA/Dec(J2000): "  + raString + "/" + decString, 0, (int)window.getHeight() - 95);

    HorizontalCoordinates az = eq.toHorizontal(obs.getLongitude(), obs.getLatitude(), obs.getSideralTime());
    String azString = Utils.rad2String(az.getAzimuth() - Math.PI, true, false);
    String altString = Utils.rad2String(az.getAltitude(), false, false);
    infoRenderer.draw("Az/Alt: " + azString + " / " + altString, 0, (int)window.getHeight() - 115);
    infoRenderer.endRendering();
}
 
开发者ID:Haurentziu,项目名称:Java-Planetarium,代码行数:27,代码来源:TextInfo.java

示例3: drawText

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
public static void drawText(TextRenderer renderer, int width, int height,
                            int posX, int posY, String text, boolean outline)
{
    renderer.beginRendering(width, height);

    if (outline)
    {
        // draw text outline in black
        renderer.setColor(0.0f, 0.0f, 0.0f, 1.0f);
        renderer.draw(text, posX - 1, posY - 1);
        renderer.draw(text, posX - 1, posY);
        renderer.draw(text, posX - 1, posY + 1);

        renderer.draw(text, posX + 1, posY - 1);
        renderer.draw(text, posX + 1, posY);
        renderer.draw(text, posX + 1, posY + 1);
    }

    // draw the actual text in white
    renderer.setColor(1.0f, 1.0f, 1.0f, 1.0f);
    renderer.draw(text, posX, posY);
    renderer.endRendering();
}
 
开发者ID:vobject,项目名称:maru,代码行数:24,代码来源:GLUtils.java

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

示例5: renderTileID

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
protected void renderTileID(DrawContext dc, RectTile tile)
{
    java.awt.Rectangle viewport = dc.getView().getViewport();
    TextRenderer textRenderer = OGLTextRenderer.getOrCreateTextRenderer(dc.getTextRendererCache(),
        java.awt.Font.decode("Arial-Plain-15"));

    //GL gl = dc.getGL();
    GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
    OGLStackHandler ogsh = new OGLStackHandler();

    try
    {
        ogsh.pushAttrib(gl, GL2.GL_ENABLE_BIT);

        dc.getGL().glDisable(GL.GL_DEPTH_TEST);
        dc.getGL().glDisable(GL.GL_BLEND);

        textRenderer.beginRendering(viewport.width, viewport.height);
        textRenderer.setColor(Color.RED);
        String tileLabel = Integer.toString(tile.level);
        double[] elevs = this.globe.getMinAndMaxElevations(tile.getSector());
        if (elevs != null)
            tileLabel += ", " + (int) elevs[0] + "/" + (int) elevs[1];

        LatLon ll = tile.getSector().getCentroid();
        Vec4 pt = dc.getGlobe().computePointFromPosition(ll.getLatitude(), ll.getLongitude(),
            dc.getGlobe().getElevation(ll.getLatitude(), ll.getLongitude()));
        pt = dc.getView().project(pt);
        textRenderer.draw(tileLabel, (int) pt.x, (int) pt.y);
        textRenderer.setColor(Color.WHITE);
        textRenderer.endRendering();
    }
    finally
    {
        ogsh.pop(gl);
    }
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:38,代码来源:MYEBSRectangularTessellator.java

示例6: drawTileIDs

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
protected void drawTileIDs(DrawContext dc, ArrayList<TextureTile> tiles)
{
	java.awt.Rectangle viewport = dc.getView().getViewport();
	TextRenderer textRenderer = OGLTextRenderer.getOrCreateTextRenderer(dc.getTextRendererCache(),
		java.awt.Font.decode("Arial-Plain-13"));
	
	GL gl = dc.getGL();
	gl.glDisable(GL.GL_DEPTH_TEST);
	gl.glDisable(GL.GL_BLEND);
	gl.glDisable(GL.GL_TEXTURE_2D);

	textRenderer.beginRendering(viewport.width, viewport.height);
	textRenderer.setColor(java.awt.Color.YELLOW);
	for (TextureTile tile : tiles)
	{
		String tileLabel = tile.getLabel();

		if (tile.getFallbackTile() != null)
			tileLabel += "/" + tile.getFallbackTile().getLabel();

		LatLon ll = tile.getSector().getCentroid();
		Vec4 pt = dc.getGlobe().computePointFromPosition(ll.getLatitude(), ll.getLongitude(),
			dc.getGlobe().getElevation(ll.getLatitude(), ll.getLongitude()));
		pt = dc.getView().project(pt);
		textRenderer.draw(tileLabel, (int) pt.x, (int) pt.y);
	}
	textRenderer.setColor(java.awt.Color.WHITE);
	textRenderer.endRendering();
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:30,代码来源:ScalingTiledImageLayer.java

示例7: renderFloat

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
@Override
public void renderFloat(Camera camera, Viewport vp, GL2 gl) {
    if (!isVisible[vp.idx])
        return;

    String text = Movie.getTime().toString();
    if (Displayer.multiview) {
        ImageLayer im = ImageLayers.getImageLayerInViewport(vp.idx);
        if (im != null) {
            text = im.getTimeString() + ' ' + im.getName();
        }
    }

    int delta = (int) (vp.height * 0.01);
    int size = (int) (vp.height * (scale * 0.01 * 0.015));

    if (GLInfo.pixelScale[1] == 1) //! nasty
        size *= 2;

    TextRenderer renderer = GLText.getRenderer(size);
    renderer.beginRendering(vp.width, vp.height, true);
    renderer.setColor(Color.BLACK);
    renderer.draw(text, delta, delta);
    renderer.setColor(Color.WHITE);
    renderer.draw(text, delta + 1, delta + 1);
    renderer.endRendering();
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:28,代码来源:TimestampLayer.java

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

示例9: drawString

import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
/**
 *
 * @todo Write documentation
 * @param string
 * @param position
 * @param font
 * @param color
 * @since 0.1
 */
public void drawString(String string, Vector2 position, Font font, Color color)
{
	if (game.getWindow().getCanvas().getGL().getGL2() != null)
	{
		TextRenderer renderer = new TextRenderer(font);
		renderer.setColor(color);
		renderer.beginRendering(game.getWindow().getCanvas().getWidth(), game.getWindow().getCanvas().getHeight());
		renderer.draw(string, (int) position.x, (int) (game.getWindow().getCanvas().getHeight() - position.y - renderer.getBounds(string).getHeight()));
		renderer.endRendering();
	}
}
 
开发者ID:TheAtlas,项目名称:Atlas-Game-Framework,代码行数:21,代码来源:SpriteBatch.java


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