Example usage for org.lwjgl.opengl GL11 glPointSize

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

Introduction

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

Prototype

public static void glPointSize(@NativeType("GLfloat") float size) 

Source Link

Document

Controls the rasterization of points if no vertex, tessellation control, tessellation evaluation, or geometry shader is active.

Usage

From source file:a1.Main.java

License:Open Source License

private void initGL() {
    // enable textures since we're going to use these for our sprites
    GL11.glPointSize(1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);/*from  w  w w .j a v a  2 s  .com*/
    GL11.glDisable(GL11.GL_LIGHTING);

    glClearColor(0.0f, 0.0f, 0.0f, 0);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    // disable the OpenGL depth test since we're rendering 2D graphics
    GL11.glDisable(GL11.GL_DEPTH_TEST);
}

From source file:com.ardor3d.renderer.lwjgl.LwjglRenderer.java

License:Open Source License

@Override
public void setupPointParameters(final float pointSize, final boolean antialiased, final boolean isSprite,
        final boolean useDistanceAttenuation, final FloatBuffer attenuationCoefficients,
        final float minPointSize, final float maxPointSize) {
    final RenderContext context = ContextManager.getCurrentContext();

    // TODO: make a record for point states
    GL11.glPointSize(pointSize);

    if (isSprite && context.getCapabilities().isPointSpritesSupported()) {
        GL11.glEnable(ARBPointSprite.GL_POINT_SPRITE_ARB);
        GL11.glTexEnvi(ARBPointSprite.GL_POINT_SPRITE_ARB, ARBPointSprite.GL_COORD_REPLACE_ARB, GL11.GL_TRUE);
    }/*from   w  w w  . j ava 2 s.c  o m*/

    if (useDistanceAttenuation && context.getCapabilities().isPointParametersSupported()) {
        ARBPointParameters.glPointParameterARB(ARBPointParameters.GL_POINT_DISTANCE_ATTENUATION_ARB,
                attenuationCoefficients);
        ARBPointParameters.glPointParameterfARB(ARBPointParameters.GL_POINT_SIZE_MIN_ARB, minPointSize);
        ARBPointParameters.glPointParameterfARB(ARBPointParameters.GL_POINT_SIZE_MAX_ARB, maxPointSize);
    }

    if (antialiased) {
        GL11.glEnable(GL11.GL_POINT_SMOOTH);
        GL11.glHint(GL11.GL_POINT_SMOOTH_HINT, GL11.GL_NICEST);
    }
}

From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java

License:Apache License

public final void glPointSize(float size) {
    GL11.glPointSize(size);
}

From source file:com.google.gapid.glviewer.GeometryScene.java

License:Apache License

@Override
public void init(Renderer renderer) {
    float[] background = new float[] { .2f, .2f, .2f, 1f };

    LOG.log(FINE, "GL Version:   " + GL11.glGetString(GL11.GL_VERSION));
    LOG.log(FINE, "GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));

    shaders = Shaders.init(renderer);// w  w w .j ava  2 s.c  o  m
    if (renderable != null) {
        renderable.init(renderer);
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClearColor(background[0], background[1], background[2], background[3]);
    GL11.glPointSize(4);
    GL30.glBindVertexArray(GL30.glGenVertexArrays());
}

From source file:com.google.gapid.glviewer.Viewer.java

License:Apache License

@Override
public void init() {
    float[] background = new float[] { .2f, .2f, .2f, 1f };

    LOG.log(FINE, "GL Version:   " + GL11.glGetString(GL11.GL_VERSION));
    LOG.log(FINE, "GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));

    shaders = Shaders.init();/*from  w  w  w .  j ava2s.co  m*/
    if (renderable != null) {
        renderable.init();
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClearColor(background[0], background[1], background[2], background[3]);
    GL11.glPointSize(4);
    GL30.glBindVertexArray(GL30.glGenVertexArrays());
}

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  w  ww .j ava  2 s  .co 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.RenderableLines.java

License:Open Source License

@Override
public void render(Matrix4f matrix, RenderStyle style) {
    dealWithChange();//w w  w .  j  a v  a  2  s  .  c o m
    if (!visible) {
        return;
    }
    if (vertCount == 0) {
        return;
    }
    GL11.glPointSize(3f);

    int pID = Resources.loadShader("lines.vs", "lines.fs").getProgram();
    GL20.glUseProgram(pID);
    if (pID == 0) {
        return;
    }
    GL30.glBindVertexArray(vaoID);
    GL20.glEnableVertexAttribArray(0);
    GL20.glEnableVertexAttribArray(1);

    Util.checkErr();

    getContext().setMatrices(pID, matrix);
    Util.checkErr();
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDrawArrays(GL11.GL_LINES, 0, vertCount);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    Util.checkErr();
    GL20.glDisableVertexAttribArray(1);
    GL20.glDisableVertexAttribArray(0);
    Util.checkErr();

    GL30.glBindVertexArray(0);
    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.  j  av a 2 s . c om

    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.sriramramani.droid.inspector.ui.InspectorCanvas.java

License:Mozilla Public License

public InspectorCanvas(Composite parent, int style, GLData data) {
    super(parent, style, data);
    setCurrent();/* w w w.j  ava  2 s.  c  o  m*/

    // Clear the canvas.
    GL11.glClearColor(CLEAR_COLOR[0], CLEAR_COLOR[1], CLEAR_COLOR[2], CLEAR_COLOR[3]);
    GL11.glClearDepth(1.0f);
    GL11.glLineWidth(1.0f);
    GL11.glPointSize(1.0f);

    GL11.glShadeModel(GL11.GL_FLAT);

    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
    GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

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

    GL11.glEnable(GL11.GL_STENCIL_TEST);
    GL11.glStencilFunc(GL11.GL_ALWAYS, 0x1, 0xf);
    GL11.glStencilOp(GL11.GL_INCR, GL11.GL_KEEP, GL11.GL_INCR);

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

    reset();

    mTransform = new Matrix4f();
    mTransform.setIdentity();

    addListener(SWT.Resize, this);
    addListener(SWT.Paint, this);
    addMouseListener(this);
    addMouseWheelListener(this);
}

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);//from w w w  .java2 s . com
    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);
}