本文整理汇总了Java中com.jogamp.opengl.util.awt.TextRenderer.setUseVertexArrays方法的典型用法代码示例。如果您正苦于以下问题:Java TextRenderer.setUseVertexArrays方法的具体用法?Java TextRenderer.setUseVertexArrays怎么用?Java TextRenderer.setUseVertexArrays使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.util.awt.TextRenderer
的用法示例。
在下文中一共展示了TextRenderer.setUseVertexArrays方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: doInit
import com.jogamp.opengl.util.awt.TextRenderer; //导入方法依赖的package包/类
@Override
protected boolean doInit(GL2ES2 gl) {
program = CompassProgram.INSTANCE;
program.init(gl);
Astroid3f astroid = new Astroid3f(1, 8);
vertices = Buffers.newDirectByteBuffer(astroid.triangles.length * 24);
for (int i = 0; i < astroid.triangles.length; i++) {
float[] point = astroid.points[astroid.triangles[i]];
float[] normal = astroid.normals[astroid.triangles[i]];
vertices.putFloat(point[0]);
vertices.putFloat(point[1]);
vertices.putFloat(point[2]);
vertices.putFloat(normal[0]);
vertices.putFloat(normal[1]);
vertices.putFloat(normal[2]);
}
vertices.rewind();
StaticRenderer.Options options = new StaticRenderer.Options(true, GL.GL_TRIANGLES);
options.addAttribute(3, GL.GL_FLOAT, false);
options.addAttribute(3, GL.GL_FLOAT, false);
renderer = new StaticRenderer(vertices, options);
renderer.init(gl);
textRenderer = new TextRenderer(labelFont, true, true, null, false);
textRenderer.init();
textRenderer.setUseVertexArrays(true);
textRenderer.setColor(Color.WHITE);
return true;
}
示例4: 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();
}
示例5: 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);
}