Example usage for org.lwjgl.opengl GL11 glEnd

List of usage examples for org.lwjgl.opengl GL11 glEnd

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glEnd.

Prototype

public static native void glEnd();

Source Link

Document

Ends the definition of vertex attributes of a sequence of primitives to be transferred to the GL.

Usage

From source file:fr.def.iss.vd2.lib_v3d.element.V3DCircle.java

License:Open Source License

private void drawExternCircle() {

    float step = 2f * (float) Math.PI / (float) quality;

    if (customColor) {
        GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    }/* w w  w .j ava  2 s .co m*/

    GL11.glBegin(GL11.GL_TRIANGLE_STRIP);

    for (int i = 0; i <= quality; i++) {
        if (customColor) {
            GL11.glColor4f(innerColor.r, innerColor.g, innerColor.b, innerColor.a);
        }
        GL11.glVertex3f((float) (innerRadius * Math.cos(step * i)), (float) (innerRadius * Math.sin(step * i)),
                0f);

        if (customColor) {
            GL11.glColor4f(outerColor.r, outerColor.g, outerColor.b, outerColor.a);
        }
        GL11.glVertex3f((float) (radius * Math.cos(step * i)), (float) (radius * Math.sin(step * i)), 0f);
    }

    GL11.glEnd();

    if (customColor) {
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glPopAttrib();
    }

}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DCircle.java

License:Open Source License

private void drawSolidCircle() {
    float step = 2f * (float) Math.PI / (float) quality;

    GL11.glBegin(GL11.GL_LINE_LOOP);//from ww w . j a v  a 2  s.c om

    for (int i = 0; i <= quality; i++) {
        GL11.glVertex3f((float) (radius * Math.cos(step * i)), (float) (radius * Math.sin(step * i)), 0f);
    }

    GL11.glEnd();

    GL11.glBegin(GL11.GL_POINTS);

    for (int i = 0; i <= quality; i++) {
        GL11.glVertex3f((float) (radius * Math.cos(step * i)), (float) (radius * Math.sin(step * i)), 0f);
    }

    GL11.glEnd();

}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DLine.java

License:Open Source License

@Override
protected void doDisplay(I3dCamera camera) {

    GL11.glLineWidth(thickness);/*  w w  w.  j  a  v  a 2s  .  c om*/

    GL11.glEnable(GL11.GL_LINE_STIPPLE);
    GL11.glLineStipple(stippleFactor, stipplePattern);

    GL11.glBegin(GL11.GL_LINES);

    GL11.glVertex3d(locationA.x, locationA.y, locationA.z);
    GL11.glVertex3d(locationB.x, locationB.y, locationB.z);

    GL11.glEnd();

    GL11.glDisable(GL11.GL_LINE_STIPPLE);
}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DPoint.java

License:Open Source License

@Override
protected void doDisplay(I3dCamera camera) {

    GL11.glPointSize(size);

    GL11.glBegin(GL11.GL_POINTS);

    GL11.glVertex3d(0, 0, 0);

    GL11.glEnd();

}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DPolygon.java

License:Open Source License

private void displayPlainPolygon() {
    if (needCompute) {
        // TODO repair
        //computePolygon();
        needCompute = false;// w  ww  .  j  a  v a 2  s . co m
    }

    for (int i = 0; i < vertexTypeList.size(); i++) {

        List<double[]> vertexList = vertexListList.get(i);

        GL11.glBegin(vertexTypeList.get(i));
        for (double[] vertex : vertexList) {
            GL11.glVertex3d(vertex[0], vertex[1], 0);
        }
        GL11.glEnd();

    }
}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DPolygon.java

License:Open Source License

private void displaySolidPolygon() {
    GL11.glLineWidth(thickness);//from   ww w. j  ava 2s  . c  o m

    GL11.glBegin(GL11.GL_LINES);

    for (int j = 0; j < pointListList.size(); j++) {
        List<V3DVect3> pointList = pointListList.get(j);

        for (int i = 0; i < pointList.size(); i++) {
            if (i == 0) {
                drawLine(pointList.get(pointList.size() - 1), pointList.get(i));
            } else {
                drawLine(pointList.get(i - 1), pointList.get(i));
            }

        }
    }

    GL11.glEnd();
}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DPolygonWalls.java

License:Open Source License

@Override
protected void doDisplay(I3dCamera camera) {

    if (renderMode == RenderMode.PLAIN) {

        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glBegin(GL11.GL_QUADS);//ww w  .  ja  va  2  s . c o  m

        for (int i = 0; i < pointList.size(); i++) {
            if (i == 0) {
                drawQuad(pointList.get(pointList.size() - 1), pointList.get(i));
            } else {
                drawQuad(pointList.get(i - 1), pointList.get(i));
            }
        }
        GL11.glEnd();
        GL11.glDisable(GL11.GL_LIGHTING);
    }
    if (renderMode == RenderMode.SOLID) {

        GL11.glLineWidth(thickness);
        GL11.glBegin(GL11.GL_LINES);

        for (V3DVect3 point : pointList) {
            float z0 = -height / 2;
            float z1 = height / 2;
            GL11.glVertex3d(point.x, point.y, z1);
            GL11.glVertex3d(point.x, point.y, z0);
        }
        GL11.glEnd();
    }
}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DRectangle.java

License:Open Source License

@Override
protected void doDisplay(I3dCamera camera) {
    float x0 = -size.x / 2;
    float y0 = -size.y / 2;
    float x1 = size.x / 2;
    float y1 = size.y / 2;

    GL11.glLineWidth(thickness);/*  w  w w. j  a  v a  2s . co  m*/

    if (renderMode == RenderMode.SOLID) {
        GL11.glEnable(GL11.GL_LINE_STIPPLE);
        GL11.glLineStipple(stippleFactor, stipplePattern);

        GL11.glBegin(GL11.GL_LINE_LOOP);

        GL11.glVertex3d(x0, y1, 0);
        GL11.glVertex3d(x0, y0, 0);
        GL11.glVertex3d(x1, y0, 0);
        GL11.glVertex3d(x1, y1, 0);

        GL11.glEnd();

        GL11.glDisable(GL11.GL_LINE_STIPPLE);
    } else {
        GL11.glBegin(GL11.GL_QUADS);

        GL11.glVertex3d(x0, y1, 0);
        GL11.glVertex3d(x0, y0, 0);
        GL11.glVertex3d(x1, y0, 0);
        GL11.glVertex3d(x1, y1, 0);

        GL11.glEnd();
    }
}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DSprite.java

License:Open Source License

@Override
protected void doDisplay(V3DCamera camera) {

    if (!enableColor) {
        GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
        GL11.glColor4f(1, 1, 1, opacity);
    }/*from ww  w  .  ja  v a 2s.  com*/

    GL11.glEnable(GL11.GL_TEXTURE_2D);

    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);

    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f);
    GL11.glEnable(GL11.GL_ALPHA_TEST);

    if (disableRotation) {
        camera.disableRotation();
    }

    float w = 0.5f * size.x * image.getWidth();
    float h = 0.5f * size.y * image.getHeight();

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getID());
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex3f(-w, -h, 0.0f);
    GL11.glTexCoord2f(1.0f, 0.0f);
    GL11.glVertex3f(w, -h, 0.0f);
    GL11.glTexCoord2f(1.0f, 1.0f);
    GL11.glVertex3f(w, h, 0.0f);
    GL11.glTexCoord2f(0.0f, 1.0f);
    GL11.glVertex3f(-w, h, 0.0f);
    GL11.glEnd();

    if (disableRotation) {
        camera.enableRotation();
    }

    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    if (!enableColor) {
        GL11.glPopAttrib();
    }
}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DTriangle.java

License:Open Source License

@Override
protected void doDisplay(I3dCamera camera) {
    float x0 = -size.x / 2;
    float y0 = -size.y / 2;
    float x1 = size.x / 2;
    float y1 = size.y / 2;

    GL11.glLineWidth(thickness);//  ww  w  .  j ava2  s  . c  om

    if (renderMode == RenderMode.SOLID) {
        GL11.glEnable(GL11.GL_LINE_STIPPLE);
        GL11.glLineStipple(stippleFactor, stipplePattern);

        GL11.glBegin(GL11.GL_LINE_LOOP);

        GL11.glVertex3d(x0, y1, 0);
        GL11.glVertex3d((x1 + x0) / 2, y0, 0);
        GL11.glVertex3d(x1, y1, 0);

        GL11.glEnd();

        GL11.glDisable(GL11.GL_LINE_STIPPLE);
    } else {
        GL11.glBegin(GL11.GL_TRIANGLES);

        GL11.glVertex3d(x0, y1, 0);
        GL11.glVertex3d((x1 + x0) / 2, y0, 0);
        GL11.glVertex3d(x1, y1, 0);

        GL11.glEnd();
    }
}