List of usage examples for com.badlogic.gdx.graphics GL20 GL_LINES
int GL_LINES
To view the source code for com.badlogic.gdx.graphics GL20 GL_LINES.
Click Source Link
From source file:airfoil.Main.java
License:Open Source License
protected final void renderMeshLines(Mesh mesh) { final ShaderProgram axesShader = this.axesShader; if (null != axesShader) { if (null != mesh) { final Matrix4 camera = this.getCamera(); axesShader.begin();/* w w w . j a va 2 s . c om*/ axesShader.setUniformMatrix("u_camera", camera); axesShader.setUniformf("u_color", Color.YELLOW); axesShader.setUniformf("u_light", LightNormal); axesShader.setUniformf("u_mat", Material); mesh.render(axesShader, GL20.GL_LINES); axesShader.end(); } } }
From source file:com.bladecoder.engine.util.Utils3D.java
License:Apache License
private static void createAxes() { ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin();/*from w w w . j av a 2s . c o m*/ MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES, Usage.Position | Usage.ColorUnpacked, new Material()); builder.setColor(Color.LIGHT_GRAY); for (float t = GRID_MIN; t <= GRID_MAX; t += GRID_STEP) { builder.line(t, 0, GRID_MIN, t, 0, GRID_MAX); builder.line(GRID_MIN, 0, t, GRID_MAX, 0, t); } builder = modelBuilder.part("axes", GL20.GL_LINES, Usage.Position | Usage.ColorUnpacked, new Material()); builder.setColor(Color.RED); builder.line(0, 0, 0, 10, 0, 0); builder.setColor(Color.GREEN); builder.line(0, 0, 0, 0, 10, 0); builder.setColor(Color.BLUE); builder.line(0, 0, 0, 0, 0, 10); axesModel = modelBuilder.end(); axesInstance = new ModelInstance(axesModel); }
From source file:com.mbrlabs.mundus.commons.g3d.MG3dModelLoader.java
License:Apache License
private int parseType(String type) { if (type.equals("TRIANGLES")) { return GL20.GL_TRIANGLES; } else if (type.equals("LINES")) { return GL20.GL_LINES; } else if (type.equals("POINTS")) { return GL20.GL_POINTS; } else if (type.equals("TRIANGLE_STRIP")) { return GL20.GL_TRIANGLE_STRIP; } else if (type.equals("LINE_STRIP")) { return GL20.GL_LINE_STRIP; } else {/* w ww .j a v a 2s . c o m*/ throw new GdxRuntimeException("Unknown primitive type '" + type + "', should be one of triangle, trianglestrip, line, linestrip, lineloop or point"); } }
From source file:com.mbrlabs.mundus.editor.utils.UsefulMeshs.java
License:Apache License
public static Model createAxes() { final float GRID_MIN = -10f; final float GRID_MAX = 10f; final float GRID_STEP = 1f; ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin();//from w w w .j a va 2 s. c om MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES, VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material()); builder.setColor(Color.LIGHT_GRAY); for (float t = GRID_MIN; t <= GRID_MAX; t += GRID_STEP) { builder.line(t, 0, GRID_MIN, t, 0, GRID_MAX); builder.line(GRID_MIN, 0, t, GRID_MAX, 0, t); } builder = modelBuilder.part("axes", GL20.GL_LINES, VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material()); builder.setColor(Color.RED); builder.line(0, 0, 0, 100, 0, 0); builder.setColor(Color.GREEN); builder.line(0, 0, 0, 0, 100, 0); builder.setColor(Color.BLUE); builder.line(0, 0, 0, 0, 0, 100); return modelBuilder.end(); }
From source file:com.mbrlabs.mundus.editor.utils.UsefulMeshs.java
License:Apache License
public static Model createArrowStub(Material mat, Vector3 from, Vector3 to) { ModelBuilder modelBuilder = new ModelBuilder(); modelBuilder.begin();/* ww w.j ava 2 s .c o m*/ MeshPartBuilder meshBuilder; // line meshBuilder = modelBuilder.part("line", GL20.GL_LINES, VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, mat); meshBuilder.line(from.x, from.y, from.z, to.x, to.y, to.z); // stub Node node = modelBuilder.node(); node.translation.set(to.x, to.y, to.z); meshBuilder = modelBuilder.part("stub", GL20.GL_TRIANGLES, Usage.Position | Usage.Normal, mat); BoxShapeBuilder.build(meshBuilder, 2, 2, 2); return modelBuilder.end(); }
From source file:gaia.cu9.ari.gaiaorbit.util.g3d.MeshBuilder2.java
License:Apache License
/** Increases the size of the backing indices array to accommodate the specified number of additional triangles. Useful before * adding many triangles to avoid multiple backing array resizes. * @param numTriangles The number of triangles you are about to add */ public void ensureTriangleIndices(int numTriangles) { if (primitiveType == GL20.GL_LINES) ensureIndices(6 * numTriangles); else/* ww w. ja v a2s .c o m*/ // GL_TRIANGLES || GL_POINTS ensureIndices(3 * numTriangles); }
From source file:gaia.cu9.ari.gaiaorbit.util.g3d.MeshBuilder2.java
License:Apache License
/** Increases the size of the backing indices array to accommodate the specified number of additional rectangles. Useful before * adding many rectangles to avoid multiple backing array resizes. * @param numRectangles The number of rectangles you are about to add */ public void ensureRectangleIndices(int numRectangles) { if (primitiveType == GL20.GL_POINTS) ensureIndices(4 * numRectangles); else if (primitiveType == GL20.GL_LINES) ensureIndices(8 * numRectangles); else//from w ww .j av a 2 s. co m // GL_TRIANGLES ensureIndices(6 * numRectangles); }
From source file:gaia.cu9.ari.gaiaorbit.util.g3d.MeshBuilder2.java
License:Apache License
@Override public void line(short index1, short index2) { if (primitiveType != GL20.GL_LINES) throw new GdxRuntimeException("Incorrect primitive type"); index(index1, index2);//from w w w . j a va 2 s . c o m }
From source file:gaia.cu9.ari.gaiaorbit.util.g3d.MeshBuilder2.java
License:Apache License
@Override public void triangle(short index1, short index2, short index3) { if (primitiveType == GL20.GL_TRIANGLES || primitiveType == GL20.GL_POINTS) { index(index1, index2, index3);// w w w. ja v a2 s. com } else if (primitiveType == GL20.GL_LINES) { index(index1, index2, index2, index3, index3, index1); } else throw new GdxRuntimeException("Incorrect primitive type"); }
From source file:gaia.cu9.ari.gaiaorbit.util.g3d.MeshBuilder2.java
License:Apache License
@Override public void rect(short corner00, short corner10, short corner11, short corner01) { if (primitiveType == GL20.GL_TRIANGLES) { index(corner00, corner10, corner11, corner11, corner01, corner00); } else if (primitiveType == GL20.GL_LINES) { index(corner00, corner10, corner10, corner11, corner11, corner01, corner01, corner00); } else if (primitiveType == GL20.GL_POINTS) { index(corner00, corner10, corner11, corner01); } else/*from ww w .j av a 2 s. co m*/ throw new GdxRuntimeException("Incorrect primitive type"); }