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:org.voxels.platform.LWJGLOpenGLAdapter.java

License:Open Source License

@Override
public int GL_POINTS() {
    return GL11.GL_POINTS;
}

From source file:shadowmage.ancient_framework.client.model.ModelPiece.java

License:Open Source License

public void renderForEditor(ModelPiece piece, Primitive prim) {
    GL11.glPushMatrix();//from  w w w.  j  a v a2 s  .c  o m
    if (x != 0 || y != 0 || z != 0) {
        GL11.glTranslatef(x, y, z);
    }
    if (rx != 0) {
        GL11.glRotatef(rx, 1, 0, 0);
    }
    if (ry != 0) {
        GL11.glRotatef(ry, 0, 1, 0);
    }
    if (rz != 0) {
        GL11.glRotatef(rz, 0, 0, 1);
    }
    if (piece == this) {
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_POINT_SMOOTH);
        GL11.glColor4f(1.0f, 0.f, 0.f, 1.f);
        GL11.glPointSize(5.f);
        GL11.glBegin(GL11.GL_POINTS);
        GL11.glVertex3f(0, 0, 0);
        GL11.glEnd();
        GL11.glColor4f(0.75f, 0.5f, 0.5f, 1.f);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
    for (Primitive primitive : this.primitives) {
        if (primitive == prim) {
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_TEXTURE_2D);

            GL11.glColor4f(1.0f, 0.f, 0.f, 1.f);

            GL11.glBegin(GL11.GL_POINTS);
            GL11.glVertex3f(prim.x, prim.y, prim.z);
            GL11.glEnd();

            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glEnable(GL11.GL_TEXTURE_2D);

            GL11.glColor4f(1.0f, 0.5f, 0.5f, 1.f);
        }
        primitive.render();
        if (primitive == prim) {
            GL11.glColor4f(0.75f, 0.5f, 0.5f, 1.f);
        }
    }
    for (ModelPiece child : this.children) {
        child.renderForEditor(piece, prim);
    }
    GL11.glColor4f(1.f, 1.f, 1.f, 1.f);
    GL11.glPopMatrix();
}

From source file:shadowmage.meim.client.gui.GuiTextureElement.java

License:Open Source License

@Override
public void drawElement(int mouseX, int mouseY) {
    int x = renderPosX + guiLeft;
    int y = renderPosY + guiTop;
    int x1 = x;/* w  w w  .  j  a v a2 s  . com*/
    int y1 = y;
    int x2 = x;
    int y2 = y + height;
    int x3 = x + width;
    int y3 = y + height;
    int x4 = x + width;
    int y4 = y;

    float pixX = 1.f / (float) image.getWidth();
    float pixY = 1.f / (float) image.getHeight();
    float u1, v1, u2, v2, u3, v3, u4, v4;
    float uw, uh;

    uw = scale;//image.getWidth() * pixX * scale;
    uh = scale;

    float u = pixX * (float) viewX;
    float v = pixY * (float) viewY;
    v = v > 1 ? 1 : v;

    u1 = u;
    v1 = v;
    u2 = u;
    v2 = v + uh;
    u3 = u + uw;
    v3 = v + uh;
    u4 = u + uw;
    v4 = v;

    bindTexture();
    GL11.glBegin(GL11.GL_QUADS);

    GL11.glTexCoord2f(u1, v1);
    GL11.glVertex3f(x1, y1, 0);
    GL11.glTexCoord2f(u2, v2);
    GL11.glVertex3f(x2, y2, 0);
    GL11.glTexCoord2f(u3, v3);
    GL11.glVertex3f(x3, y3, 0);
    GL11.glTexCoord2f(u4, v4);
    GL11.glVertex3f(x4, y4, 0);

    GL11.glEnd();
    resetBoundTexture();

    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glColor4f(1.f, 0.f, 0.f, 1.f);
    GL11.glPointSize(5);
    GL11.glBegin(GL11.GL_POINTS);
    GL11.glVertex3f(x, y, 0.f);
    GL11.glEnd();
    GL11.glColor4f(1.f, 1.f, 1.f, 1.f);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:taiga.gpvm.render.ColorEntityRenderer.java

License:Open Source License

@Override
public void render(Collection<Entity> ents, int pass, ReadableMatrix4 proj, ReadableMatrix4 modelview) {
    if (pass != HardcodedValues.OPAQUE_WORLD_LAYER)
        return;//from w w  w  .j  a va2s  .co m

    ARBShaderObjects.glUseProgramObjectARB(0);
    GL11.glPointSize(size);

    FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
    proj.store(buffer, false);
    buffer.flip();

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadMatrix(buffer);

    buffer.rewind();
    modelview.store(buffer, false);
    buffer.flip();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadMatrix(buffer);

    GL11.glBegin(GL11.GL_POINTS);

    for (Entity ent : ents) {
        ReadableVector3f loc = ent.getBounds().getCenter();
        GL11.glVertex3f(loc.getX(), loc.getY(), loc.getZ());
        GL11.glColor3f(red, green, blue);
    }

    GL11.glEnd();
}

From source file:taiga.mcmods.buildguide.BlockMarker.java

private void createDisplayList() {
    //if neded create the list
    if (displaylist == -1)
        displaylist = GL11.glGenLists(1);

    GL11.glNewList(displaylist, GL11.GL_COMPILE_AND_EXECUTE);

    GL11.glDisable(GL11.GL_FOG);/*ww w.  j  a va  2  s.c  o m*/
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_POINT_SMOOTH);

    GL11.glBegin(GL11.GL_POINTS);
    if (color != null)
        GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
    for (Point3D pt : points)
        GL11.glVertex3d(pt.getX(), pt.getY(), pt.getZ());
    GL11.glEnd();

    GL11.glEnable(GL11.GL_TEXTURE_2D);

    GL11.glEndList();

    regendisplist = false;
}

From source file:tectonicus.rasteriser.lwjgl.LwjglRasteriser.java

License:BSD License

public void beginShape(PrimativeType type) {
    int glType = GL11.GL_TRIANGLES;
    switch (type) {
    case Points:/*from ww w  .  ja  v  a  2 s .  c om*/
        glType = GL11.GL_POINTS;
        break;
    case Lines:
        glType = GL11.GL_LINES;
        break;
    case Triangles:
        glType = GL11.GL_TRIANGLES;
        break;
    case Quads:
        glType = GL11.GL_QUADS;
        break;
    default:
        assert false;
    }
    GL11.glBegin(glType);
}

From source file:thebounzer.org.lwgldemo.Chapter5.java

License:Open Source License

@Override
public void loopCycle() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
    float f = (float) (time * Math.PI * 0.1f);
    Matrix4f modelViewM = new Matrix4f();
    Matrix4f mat = new Matrix4f();
    Matrix4f transOne = new Matrix4f();
    Matrix4f transTwo = new Matrix4f();
    Matrix4f rotaOne = new Matrix4f();
    Matrix4f rotaTwo = new Matrix4f();
    Matrix4f.translate(new Vector3f(0.0f, 0.0f, -0.4f), mat, transOne);
    Matrix4f.translate(new Vector3f((float) Math.sin(2.1f * f) * 0.5f, (float) Math.cos(1.7f * f) * 0.5f,
            (float) Math.sin(1.3f * f) * (float) Math.cos(1.5 * f) * 2.0f), mat, transTwo);
    Matrix4f.rotate(time * 45.0f, new Vector3f(0.0f, 1.0f, 0.0f), mat, rotaOne);
    Matrix4f.rotate(time * 81.0f, new Vector3f(1.0f, 0.0f, 0.0f), mat, rotaTwo);
    Matrix4f.mul(modelViewM, transOne, modelViewM);
    Matrix4f.mul(modelViewM, transTwo, modelViewM);
    Matrix4f.mul(modelViewM, rotaOne, modelViewM);
    Matrix4f.mul(modelViewM, rotaTwo, modelViewM);

    GL20.glUseProgram(program.getId());//from w  ww  . ja va 2  s .c  om
    FloatBuffer matrixBuf = BufferUtils.createFloatBuffer(16);
    modelViewM.store(matrixBuf);
    matrixBuf.flip();
    int uniLoc = GL20.glGetUniformLocation(program.getId(), "mv_matrix");
    GL20.glUniformMatrix4(uniLoc, false, matrixBuf);
    int uniProjMatLoc = GL20.glGetUniformLocation(program.getId(), "proj_matrix");
    GL20.glUniformMatrix4(uniProjMatLoc, false, matrixBuf);
    vaoId = GL30.glGenVertexArrays();
    GL30.glBindVertexArray(vaoId);
    GL11.glDrawArrays(GL11.GL_POINTS, 0, 36);
    GL20.glUseProgram(0);
    time += 0.001f;
}

From source file:vertigo.graphics.lwjgl.LWJGL_Renderer.java

License:Open Source License

/**
 * Makes conversion Vertigo style/OpenGL style
 * @param vertigo_style//from w w w . j  a  v  a2 s  . c om
 * @return 
 */
private int getOpenGLStyle(String vertigo_style) {
    int style = calcIndex(vertigo_style);
    switch (style) {
    case 379: // LINES
        return GL11.GL_LINES;
    case 1116: // LINES_ADJACENCY
        return GL32.GL_LINES_ADJACENCY;
    case 705: // LINE_LOOP
        return GL11.GL_LINE_LOOP;
    case 793: // LINE_STRIP
        return GL11.GL_LINE_STRIP;
    case 1530: // LINE_STRIP_ADJACENCY
        return GL32.GL_LINE_STRIP_ADJACENCY;
    case 477: // POINTS
        return GL11.GL_POINTS;
    case 681: // TRIANGLES
        return GL11.GL_TRIANGLES;
    case 1418: // TRIANGLES_ADJACENCY
        return GL32.GL_TRIANGLES_ADJACENCY;
    case 906: // TRIANGLE_FAN
        return GL11.GL_TRIANGLE_FAN;
    case 1095: // TRIANGLE_STRIP
        return GL11.GL_TRIANGLE_STRIP;
    case 1832: // TRIANGLE_STRIP_ADJACENCY
        return GL32.GL_TRIANGLE_STRIP_ADJACENCY;
    default: // Do nothing  
        return -1;
    }
}

From source file:zildo.fwk.gfx.Ortho.java

License:Open Source License

public void drawChar(int x, int y, char a) {
    int aa = a;//w ww.ja v  a2  s .  c  om
    if (aa != 32) {
        if (a == '.') {
            aa = 26;
        } else if (a == '\'') {
            aa = 62;
        } else if (a == '-') {
            aa = 63;
        } else if (aa >= 48 && aa <= 57) {
            aa -= 48 - 28;
        } else {
            if (aa >= 'a' && aa <= 'z') {
                aa -= 'a'; // -1;
            } else if (aa > 199) {
                aa -= 161;
            } else {
                aa -= 64;
            }
        }
        if (aa >= 0 && aa < fonts.length) {
            GL11.glBegin(GL11.GL_POINTS);
            for (int i = 0; i < 5; i++) {
                for (int j = 0; j < 5; j++) {
                    char pixel = fonts[aa][j][i];
                    if (pixel == 1) {
                        GL11.glVertex2i(x + i, y + j);
                        GL11.glVertex2f(x + i + 0.5f, y + j);
                        // GL11.glVertex2f(x+i+0.5f, y+j+0.5f);
                        // GL11.glVertex2f(x+i, y+j+0.5f);
                    }
                }
            }
            GL11.glEnd();
        }
    }
}

From source file:zildo.platform.opengl.LwjglOrtho.java

License:Open Source License

@Override
public void drawOneChar(int x, int y, int aa) {
    GL11.glBegin(GL11.GL_POINTS);
    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < 5; j++) {
            char pixel = fonts[aa][j][i];
            if (pixel == 1) {
                GL11.glVertex2i(x + i, y + j);
                GL11.glVertex2f(x + i + 0.5f, y + j);
                // GL11.glVertex2f(x+i+0.5f, y+j+0.5f);
                // GL11.glVertex2f(x+i, y+j+0.5f);
            }/*from  ww  w  .jav  a2  s.c  o m*/
        }
    }
    GL11.glEnd();
}