Example usage for org.lwjgl.opengl GL11 GL_POINTS

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

Introduction

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

Prototype

int GL_POINTS

To view the source code for org.lwjgl.opengl GL11 GL_POINTS.

Click Source Link

Document

BeginMode

Usage

From source file:com.grillecube.engine.renderer.MainRenderer.java

private void renderPostProcessingEffects() {

    if (this._post_processing_program != null) {

        // bind the fbo texture to texture attachment 0
        this.getFBOTexture().bind(GL13.GL_TEXTURE0, GL11.GL_TEXTURE_2D);

        this._post_processing_program.useStart();
        this._post_processing_program.loadUniforms(this);
        this._default_vao.bind();
        GLH.glhDrawArrays(GL11.GL_POINTS, 0, 1);
        this._post_processing_program.useStop();
    }//from ww  w.j a  va 2s. co m
}

From source file:com.grillecube.engine.renderer.world.particles.ParticleRenderer.java

/** render every quad particles */
private void renderBillboardedParticles(World world, CameraProjectiveWorld camera) {
    if (this._billboarded_particles.size() == 0) {
        return;/*from   w  ww  .  j  a  v a  2 s .c  o  m*/
    }
    GL13.glActiveTexture(GL13.GL_TEXTURE0 + 0); // Texture unit 0

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    this._program_billboarded_particle.useStart();
    this.getParent().getDefaultVAO().bind();

    this._program_billboarded_particle.loadGlobalUniforms(camera);
    this._billboarded_particles.sort(this._particle_comparator);

    int i = 0;
    while (i < this._billboarded_particles.size()) {

        ParticleBillboarded particle = this._billboarded_particles.get(i);
        float radius = Maths.max(particle.getScale().x, particle.getScale().y);
        if (particle != null && particle.getCameraSquareDistance() < camera.getSquaredRenderDistance()
                && camera.isSphereInFrustum(particle.getPosition(), radius)) {
            this._program_billboarded_particle.loadInstanceUniforms(particle);
            this.getParent().getDefaultVAO().draw(GL11.GL_POINTS, 0, 1);
        }
        ++i;
    }
}

From source file:com.irr310.i3d.scene.I3dEye3DCamera.java

License:Open Source License

private void displayTarget() {

    GL11.glColor4f(1.0f, 0.5f, 0.5f, 0.8f);
    GL11.glLineWidth(1.2f);//from  ww w. j  ava2 s. c  o  m
    GL11.glBegin(GL11.GL_LINES);
    {

        GL11.glColor4f(1.0f, 0.0f, 0.0f, 0.8f);
        GL11.glVertex3d(-1, 0, 0);
        GL11.glVertex3d(1, 0, 0);

        GL11.glVertex3d(0.9, 0.1, 0);
        GL11.glVertex3d(1, 0, 0);

        GL11.glVertex3d(0.9, -0.1, 0);
        GL11.glVertex3d(1, 0, 0);

        // y
        GL11.glColor4f(0.0f, 1.0f, 0.0f, 0.8f);
        GL11.glVertex3d(0, -1, 0);
        GL11.glVertex3d(0, 1, 0);

        GL11.glVertex3d(0.1, 0.9, 0);
        GL11.glVertex3d(0, 1, 0);

        GL11.glVertex3d(-0.1, 0.9, 0);
        GL11.glVertex3d(0, 1, 0);

        // z
        GL11.glColor4f(0.0f, 0.0f, 1.0f, 0.8f);
        GL11.glVertex3d(0, 0, -1);
        GL11.glVertex3d(0, 0, 1);

        GL11.glVertex3d(0.1, 0, 0.9);
        GL11.glVertex3d(0, 0, 1);

        GL11.glVertex3d(-0.1, 0, 0.9);
        GL11.glVertex3d(0, 0, 1);

    }
    GL11.glEnd();

    GL11.glPointSize(1.2f);
    GL11.glBegin(GL11.GL_POINTS);
    {
        GL11.glVertex3d(position.x, position.y, position.z);

    }
    GL11.glEnd();

}

From source file:com.opengrave.og.base.RenderableParticles.java

License:Open Source License

@Override
public void render(Matrix4f matrix, RenderStyle style) {
    dealWithChange();/*from  w  w w .  j  av a2  s. c om*/
    if (matList == null || !matList.valid()) {
        return;
    }
    GL30.glBindVertexArray(idVao);
    int pID = Resources.loadShader("particle.vs", "particle.fs").getProgram();
    GL20.glUseProgram(pID);
    GL20.glEnableVertexAttribArray(0);
    GL20.glEnableVertexAttribArray(1);
    GL20.glEnableVertexAttribArray(2);
    GL20.glBindAttribLocation(pID, 0, "in_Position");
    GL20.glBindAttribLocation(pID, 1, "in_Colour");
    GL20.glBindAttribLocation(pID, 2, "in_Scale");
    Util.checkErr();
    int texture = GL20.glGetUniformLocation(pID, "tex");
    GL20.glUniform1i(texture, 0);
    int wSS = GL20.glGetUniformLocation(pID, "windowSizeScale");

    GL20.glUniform1f(wSS, getContext().width / 1024f);
    getContext().setMatrices(pID, matrix);
    if (matList != null && matList.valid()) {
        matList.bind(pID, GL13.GL_TEXTURE0);
    }
    GL11.glEnable(GL20.GL_POINT_SPRITE);
    GL11.glEnable(GL20.GL_VERTEX_PROGRAM_POINT_SIZE);
    GL11.glDepthMask(false);
    GL11.glDrawArrays(GL11.GL_POINTS, 0, size);
    GL11.glDepthMask(true);
    GL11.glDisable(GL20.GL_POINT_SPRITE);
    GL11.glDisable(GL20.GL_VERTEX_PROGRAM_POINT_SIZE);

    if (matList != null && matList.valid()) {
        matList.unbind();
    }
    Util.checkErr();

    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(1);
    GL20.glDisableVertexAttribArray(2);

    Util.checkErr();

    GL20.glUseProgram(0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL30.glBindVertexArray(0);
    Util.checkErr();
}

From source file:com.opengrave.og.base.RenderableParticles.java

License:Open Source License

@Override
public void renderForPicking(Matrix4f matrix, Pickable object) {
    dealWithChange();//from  w w  w  . ja  va2 s.co  m
    GL30.glBindVertexArray(idVao);
    int pID = Resources.loadShader("particle.vs", "pickingmodel.fs").getProgram();
    GL20.glUseProgram(pID);
    GL20.glEnableVertexAttribArray(0);
    GL20.glEnableVertexAttribArray(2);
    GL20.glBindAttribLocation(pID, 0, "in_Position");
    GL20.glBindAttribLocation(pID, 2, "in_Scale");
    Util.checkErr();

    int wSS = GL20.glGetUniformLocation(pID, "windowSizeScale");

    GL20.glUniform1f(wSS, MainThread.lastW / 1024f);
    getContext().setMatrices(pID, matrix);
    GL11.glEnable(GL20.GL_POINT_SPRITE);
    GL11.glEnable(GL20.GL_VERTEX_PROGRAM_POINT_SIZE);
    Picking.registerObject(pID, getContext(), object);
    GL11.glDrawArrays(GL11.GL_POINTS, 0, size);
    GL11.glDisable(GL20.GL_POINT_SPRITE);
    GL11.glDisable(GL20.GL_VERTEX_PROGRAM_POINT_SIZE);

    Util.checkErr();

    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(2);

    Util.checkErr();

    GL20.glUseProgram(0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL30.glBindVertexArray(0);
    Util.checkErr();
}

From source file:com.opengrave.og.base.RenderablePoints.java

License:Open Source License

@Override
public void render(Matrix4f matrix, RenderStyle style) {
    Util.checkErr();/*from www .  ja v  a  2 s .  c o m*/

    dealWithChange();
    if (!visible) {
        return;
    }
    if (vertCount == 0) {
        return;
    }
    Util.checkErr();
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    Util.checkErr();
    GL11.glPointSize(3f);
    Util.checkErr();
    int pID = Resources.loadShader("particle.vs", "particle.fs").getProgram();
    Util.checkErr();
    GL20.glUseProgram(pID);
    Util.checkErr();
    if (pID == 0) {
        return;
    }
    Util.checkErr();
    GL30.glBindVertexArray(vaoID);
    Util.checkErr();
    GL20.glEnableVertexAttribArray(0);
    GL20.glEnableVertexAttribArray(1);
    GL20.glEnableVertexAttribArray(2);

    Util.checkErr();
    int wSS = GL20.glGetUniformLocation(pID, "windowSizeScale");

    GL20.glUniform1f(wSS, MainThread.lastW / 1024f);

    getContext().setMatrices(pID, matrix);
    Util.checkErr();

    if (tex != null) {
        tex.bind(GL13.GL_TEXTURE0);
    }
    GL11.glEnable(GL20.GL_POINT_SPRITE);
    GL11.glEnable(GL20.GL_VERTEX_PROGRAM_POINT_SIZE);
    GL11.glDrawArrays(GL11.GL_POINTS, 0, vertCount);

    GL11.glDisable(GL20.GL_POINT_SPRITE);
    GL11.glDisable(GL20.GL_VERTEX_PROGRAM_POINT_SIZE);
    if (tex != null) {
        tex.unbind();
    }
    Util.checkErr();

    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(1);
    GL20.glDisableVertexAttribArray(2);
    Util.checkErr();

    GL30.glBindVertexArray(0);
    GL20.glUseProgram(0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL30.glBindVertexArray(0);
    Util.checkErr();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:com.wicpar.sinkingsimulatorclassic.Ship.java

License:Open Source License

@Override
public void draw() {
    final Camera cam = Main.ClassicSinkingSim.getInstance().getCam();
    GL11.glEnable(GL11.GL_DEPTH_TEST);/* w w w.  ja  v  a2  s . co m*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPointSize((float) Main.ClassicSinkingSim.getInstance().getCam().scaleSize(0.1));
    GL11.glBegin(GL11.GL_POINTS);
    for (Shipsel[] s : shipsels) {
        if (s != null)
            for (Shipsel shipsel : s) {
                if (shipsel != null) {
                    Color c = shipsel.getColor();
                    Vector3d pos = shipsel.getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.8);
                }
            }
    }
    GL11.glEnd();
    GL11.glPointSize(1);

    GL11.glLineWidth((float) Main.ClassicSinkingSim.getInstance().getCam().scaleSize(0.1));
    boolean t, b, l, r, e, f;

    Color c;
    Vector3d pos;
    GL11.glBegin(GL11.GL_LINES);
    for (int y = 0; y < springs[1].length; y++) {
        for (int x = 0; x < springs[1][y].length; x++) {
            t = springs[0][y][x];
            l = springs[2][y][x];
            e = springs[1][y][x];
            f = springs[3][y][x];

            if (t && (shipsels[y][x] == null || shipsels[y][x + 1] == null)) {
                springs[0][y][x] = false;
            }
            if (l && (shipsels[y][x] == null || shipsels[y + 1][x] == null)) {
                springs[2][y][x] = false;
            }
            if (e && (shipsels[y][x] == null || shipsels[y + 1][x + 1] == null)) {
                springs[1][y][x] = false;
            }
            if (f && (shipsels[y][x + 1] == null || shipsels[y + 1][x] == null)) {
                springs[3][y][x] = false;
            }

            t = springs[0][y][x];
            b = springs[0][y + 1][x];
            l = springs[2][y][x];
            r = springs[2][y][x + 1];
            e = springs[1][y][x];
            f = springs[3][y][x];

            if (t && b && l && r && e && f)
                continue;
            if (t && r && e)
                continue;
            if (b && l && e)
                continue;
            if (t && l && f)
                continue;
            if (b && r && f)
                continue;
            if (t) {
                c = shipsels[y][x].getColor();
                pos = shipsels[y][x].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9);
                c = shipsels[y][x + 1].getColor();
                pos = shipsels[y][x + 1].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9);

            }
            if (l) {
                c = shipsels[y][x].getColor();
                pos = shipsels[y][x].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9);
                c = shipsels[y + 1][x].getColor();
                pos = shipsels[y + 1][x].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9);

            }
            if (e) {
                c = shipsels[y][x].getColor();
                pos = shipsels[y][x].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9);
                c = shipsels[y + 1][x + 1].getColor();
                pos = shipsels[y + 1][x + 1].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9);

            }
            if (f) {
                c = shipsels[y][x + 1].getColor();
                pos = shipsels[y][x + 1].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9);
                c = shipsels[y + 1][x].getColor();
                pos = shipsels[y + 1][x].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9);

            }
        }
    }
    GL11.glEnd();
    GL11.glBegin(GL11.GL_TRIANGLES);
    for (int y = 0; y < springs[1].length; y++) {
        for (int x = 0; x < springs[1][y].length; x++) {
            t = springs[0][y][x];
            b = springs[0][y + 1][x];
            l = springs[2][y][x];
            r = springs[2][y][x + 1];
            e = springs[1][y][x];
            f = springs[3][y][x];

            if (t && b && l && r && e && f) {

                c = shipsels[y][x].getColor();
                pos = shipsels[y][x].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                c = shipsels[y][x + 1].getColor();
                pos = shipsels[y][x + 1].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                c = shipsels[y + 1][x].getColor();
                pos = shipsels[y + 1][x].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                c = shipsels[y][x + 1].getColor();
                pos = shipsels[y][x + 1].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                c = shipsels[y + 1][x].getColor();
                pos = shipsels[y + 1][x].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                c = shipsels[y + 1][x + 1].getColor();
                pos = shipsels[y + 1][x + 1].getPos();
                GL11.glColor4f(c.r, c.g, c.b, c.a);
                GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

            } else {
                if (t && r && e) {
                    c = shipsels[y][x].getColor();
                    pos = shipsels[y][x].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                    c = shipsels[y][x + 1].getColor();
                    pos = shipsels[y][x + 1].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                    c = shipsels[y + 1][x + 1].getColor();
                    pos = shipsels[y + 1][x + 1].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);
                }
                if (b && l && e) {
                    c = shipsels[y][x].getColor();
                    pos = shipsels[y][x].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                    c = shipsels[y + 1][x].getColor();
                    pos = shipsels[y + 1][x].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                    c = shipsels[y + 1][x + 1].getColor();
                    pos = shipsels[y + 1][x + 1].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);
                }
                if (t && l && f) {
                    c = shipsels[y][x].getColor();
                    pos = shipsels[y][x].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                    c = shipsels[y][x + 1].getColor();
                    pos = shipsels[y][x + 1].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                    c = shipsels[y + 1][x].getColor();
                    pos = shipsels[y + 1][x].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);
                }
                if (b && r && f) {
                    c = shipsels[y + 1][x].getColor();
                    pos = shipsels[y + 1][x].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                    c = shipsels[y + 1][x + 1].getColor();
                    pos = shipsels[y + 1][x + 1].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);

                    c = shipsels[y][x + 1].getColor();
                    pos = shipsels[y][x + 1].getPos();
                    GL11.glColor4f(c.r, c.g, c.b, c.a);
                    GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1);
                }
            }
        }
    }
    GL11.glEnd();
    GL11.glLineWidth(1);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
}

From source file:com.xrbpowered.gl.res.shaders.FeedbackVertices.java

License:Open Source License

public void transform() {
    GL30.glBindVertexArray(vaoId);/*from   w ww.  j  a  va 2s.com*/
    GL11.glEnable(GL30.GL_RASTERIZER_DISCARD);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboId);

    transformShader.use();
    transformShader.info.initAttribPointers();
    transformShader.info.enableAttribs();

    GL30.glBindBufferBase(GL30.GL_TRANSFORM_FEEDBACK_BUFFER, 0, vboFeedbackId);
    GL30.glBeginTransformFeedback(GL11.GL_POINTS);
    GL11.glDrawArrays(GL11.GL_POINTS, 0, countElements);
    GL30.glEndTransformFeedback();

    transformShader.info.disableAttribs();
    transformShader.unuse();
    GL11.glDisable(GL30.GL_RASTERIZER_DISCARD);
}

From source file:com.xrbpowered.gl.res.shaders.FeedbackVertices.java

License:Open Source License

public void draw() {
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboFeedbackId);
    renderShader.use();//w w w  .  ja  va  2s.c  om
    renderShader.info.enableAttribs();
    renderShader.info.initAttribPointers();

    if (vboiId != GL11.GL_INVALID_VALUE) {
        GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboiId);
        GL11.glDrawElements(GL11.GL_POINTS, countElements, GL11.GL_UNSIGNED_INT, 0);
    } else {
        GL11.glDrawArrays(GL11.GL_POINTS, 0, countElements);
    }

    renderShader.info.disableAttribs();
    renderShader.unuse();
    GL30.glBindVertexArray(0);
}

From source file:com.xrbpowered.gl.res.StaticMesh.java

License:Open Source License

public static int getDrawMode(int verticesPerElement) {
    switch (verticesPerElement) {
    case 1:/*  w w  w  .  j  a  va 2s .  co  m*/
        return GL11.GL_POINTS;
    case 2:
        return GL11.GL_LINES;
    case 3:
        return GL11.GL_TRIANGLES;
    default:
        throw new InvalidParameterException();
    }
}