Example usage for com.badlogic.gdx.graphics GL10 GL_LINES

List of usage examples for com.badlogic.gdx.graphics GL10 GL_LINES

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics GL10 GL_LINES.

Prototype

int GL_LINES

To view the source code for com.badlogic.gdx.graphics GL10 GL_LINES.

Click Source Link

Usage

From source file:com.altportalgames.colorrain.utils.Box2DDebugRenderer.java

License:Apache License

private void drawSolidCircle(Vector2 center, float radius, Vector2 axis, Color color) {
    renderer.begin(GL10.GL_LINE_LOOP);//  ww w.  j  av a  2s  .c o m
    float angle = 0;
    float angleInc = 2 * (float) Math.PI / 20;
    for (int i = 0; i < 20; i++, angle += angleInc) {
        v.set((float) Math.cos(angle) * radius + center.x, (float) Math.sin(angle) * radius + center.y);
        renderer.color(color.r, color.g, color.b, color.a);
        renderer.vertex(v.x * Assets.PIXELS_PER_METER_X, v.y * Assets.PIXELS_PER_METER_Y, 0);
    }
    renderer.end();

    renderer.begin(GL10.GL_LINES);
    renderer.color(color.r, color.g, color.b, color.a);
    renderer.vertex(center.x * Assets.PIXELS_PER_METER_X, center.y * Assets.PIXELS_PER_METER_Y, 0);
    renderer.color(color.r, color.g, color.b, color.a);
    renderer.vertex(center.x * Assets.PIXELS_PER_METER_X + axis.x * Assets.PIXELS_PER_METER_X * radius,
            center.y * Assets.PIXELS_PER_METER_X + axis.y * radius * Assets.PIXELS_PER_METER_Y, 0);
    renderer.end();
}

From source file:com.altportalgames.colorrain.utils.Box2DDebugRenderer.java

License:Apache License

private void drawSegment(Vector2 x1, Vector2 x2, Color color) {
    renderer.begin(GL10.GL_LINES);
    renderer.color(color.r, color.g, color.b, color.a);
    renderer.vertex(x1.x * Assets.PIXELS_PER_METER_X, x1.y * Assets.PIXELS_PER_METER_Y, 0);
    renderer.color(color.r, color.g, color.b, color.a);
    renderer.vertex(x2.x * Assets.PIXELS_PER_METER_X, x2.y * Assets.PIXELS_PER_METER_Y, 0);
    renderer.end();//from  w ww  . j  a  v a2 s.c om
}

From source file:com.badlogic.gdx.graphics.g3d.test.KeyframedModelViewer.java

License:Apache License

private void drawAxes() {
    float len = bounds.getDimensions().len();
    renderer.begin(GL10.GL_LINES);
    renderer.color(1, 0, 0, 1);//from ww w  . j a  v  a 2s .  c o m
    renderer.vertex(0, 0, 0);
    renderer.color(1, 0, 0, 1);
    renderer.vertex(len, 0, 0);
    renderer.color(0, 1, 0, 1);
    renderer.vertex(0, 0, 0);
    renderer.color(0, 1, 0, 1);
    renderer.vertex(0, len, 0);
    renderer.color(0, 0, 1, 1);
    renderer.vertex(0, 0, 0);
    renderer.color(0, 0, 1, 1);
    renderer.vertex(0, 0, len);
    renderer.end();
    Gdx.gl10.glColor4f(1, 1, 1, 1);
}

From source file:com.badlogic.gdx.graphics.g3d.test.Viewer.java

License:Apache License

private void renderSkeleton() {
    renderer.begin(GL10.GL_LINES);
    for (int i = 0; i < model.skeleton.sceneMatrices.size; i++) {
        SkeletonKeyframe joint = model.skeleton.bindPoseJoints.get(i);
        if (joint.parentIndex == -1)
            continue;

        point1.set(0, 0, 0).mul(model.skeleton.sceneMatrices.get(i));
        point2.set(0, 0, 0).mul(model.skeleton.sceneMatrices.get(joint.parentIndex));

        renderer.color(1, 1, 1, 1);/*from   w w  w. j ava  2  s . c  om*/
        renderer.vertex(point1);
        renderer.color(1, 1, 1, 1);
        renderer.vertex(point2);
    }
    renderer.end();
}

From source file:com.kingx.dungeons.graphics.cube.CubeRenderer.java

License:Apache License

private void renderMesh() {
    if (idx == 0)
        return;/*  w w  w .j  a  v  a2  s . c o m*/

    renderCalls++;
    totalRenderCalls++;
    int quadsInBatch = idx / verticesPerQuad;
    if (quadsInBatch / Cube.QUADS > cubeCount)
        cubeCount = quadsInBatch;

    mesh.setVertices(vertices, 0, idx);
    mesh.getIndicesBuffer().position(0);
    mesh.getIndicesBuffer().limit(quadsInBatch * CubeSide.INDICES);

    total += idx;
    if (blendingDisabled) {
        Gdx.gl.glDisable(GL20.GL_BLEND);
    } else {
        Gdx.gl.glEnable(GL20.GL_BLEND);
        if (blendSrcFunc != -1)
            Gdx.gl.glBlendFunc(blendSrcFunc, blendDstFunc);
    }

    if (customShader != null)
        mesh.render(customShader, App.DEBUG != null && App.isWireframe() ? GL10.GL_LINES : GL10.GL_TRIANGLES, 0,
                quadsInBatch * CubeSide.INDICES);
    else
        mesh.render(shader, App.DEBUG != null && App.isWireframe() ? GL10.GL_LINES : GL10.GL_TRIANGLES, 0,
                quadsInBatch * CubeSide.INDICES);

    idx = 0;
    currBufferIdx++;
    if (currBufferIdx == buffers.length)
        currBufferIdx = 0;
    mesh = buffers[currBufferIdx];
}

From source file:org.interreg.docexplore.reader.DebugGraphics.java

License:Open Source License

public void drawLine(double x1, double y1, double x2, double y2) {
    FloatBuffer data = twoMesh.getVerticesBuffer();
    data.limit(data.capacity());//from w  w w. j a  va 2 s.com
    data.put(0, (float) x1).put(1, (float) y1).put(2, 0);
    data.put(3, (float) x2).put(4, (float) y2).put(5, 0);
    twoMesh.render(GL10.GL_LINES);
}