Example usage for org.lwjgl.opengl GL20 glDisableVertexAttribArray

List of usage examples for org.lwjgl.opengl GL20 glDisableVertexAttribArray

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL20 glDisableVertexAttribArray.

Prototype

public static void glDisableVertexAttribArray(@NativeType("GLuint") int index) 

Source Link

Document

Disables a generic vertex attribute array.

Usage

From source file:com.redthirddivision.quad.rendering.renderers.GuiRenderer.java

License:Apache License

@Override
public void render(ArrayList<GuiTexture> elements) {
    shader.start();/*  w w w .j a va 2  s .c om*/

    GL30.glBindVertexArray(quad.getVaoID());
    GL20.glEnableVertexAttribArray(0);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    for (GuiTexture gui : elements) {
        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, gui.getTexture());
        Matrix4f matrix = MathHelper.createTransformationMatrix(gui.getPosition(), gui.getScale(),
                new Vector2f(0, 0));
        shader.loadTransformation(matrix);
        GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, quad.getVertexCount());
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL20.glDisableVertexAttribArray(0);
    GL30.glBindVertexArray(0);

    shader.stop();
}

From source file:com.redthirddivision.quad.rendering.renderers.TerrainRenderer.java

License:Apache License

@Override
protected void unbindTexturedModel() {
    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(1);
    GL20.glDisableVertexAttribArray(2);
    GL30.glBindVertexArray(0);
}

From source file:com.rfdickerson.openworld.CubeGeometry.java

@Override
void draw(SceneNode node) {

    if (!this.isLoaded) {
        this.init();
    } else {/* w w  w  .ja  v a2s.co  m*/

        GLSLShaderService shaderService = GLSLShaderService.getInstance();
        // use shader
        Shader basic = shaderService.findShader("basic");
        if (basic == null) {
            log.error("Could not find shader");
        } else {
            //shaderService.useShader(basic);
            //basic.setUniform4f("projectionMatrix", c.getProjectionMatrix());
            //basic.setUniform4f("viewMatrix", c.getViewMatrix());
            //basic.setUniform4f("modelMatrix", t);
            basic.setUniform4f("MVPMatrix", node.getMVPMatrix());
            basic.setUniform4f("MVMatrix", node.getMVMatrix());
            basic.setUniform3f("NormalMatrix", node.getNormalMatrix());

            shaderService.useShader(basic);

            GL20.glBindAttribLocation(basic.getProgramID(), 0, "in_Position");
        }

        GL30.glBindVertexArray(vaoId);
        GL20.glEnableVertexAttribArray(0);

        GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboiId);

        GL11.glDrawElements(GL11.GL_TRIANGLE_FAN, indicesCount, GL11.GL_UNSIGNED_BYTE, 0);

        GL20.glDisableVertexAttribArray(0);
        GL30.glBindVertexArray(0);
    }

    exitOnGLError("draw terrain patch");

}

From source file:com.rfdickerson.openworld.CubeGeometry.java

@Override
void cleanup() {/*from w ww .  j  a v  a  2  s .com*/

    log.info("Cleaning up the SimpleTerrain");

    GL20.glDisableVertexAttribArray(0);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL15.glDeleteBuffers(vboId);

    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
    GL15.glDeleteBuffers(vboiId);

    GL30.glBindVertexArray(0);
    GL30.glDeleteVertexArrays(vaoId);

    this.isLoaded = false;

}

From source file:com.rfdickerson.openworld.RenderSurface.java

@Override
void draw(SceneNode node) {

    if (!this.isLoaded) {
        this.init();
    } else {//w w w . j  a  v  a  2s . c o m

        GLSLShaderService shaderService = GLSLShaderService.getInstance();
        // use shader
        Shader basic = shaderService.findShader("basic");
        if (basic == null) {
            log.error("Could not find shader");
        } else {
            //shaderService.useShader(basic);
            //basic.setUniform4f("projectionMatrix", c.getProjectionMatrix());
            //basic.setUniform4f("viewMatrix", c.getViewMatrix());
            //basic.setUniform4f("modelMatrix", t);

            shaderService.useShader(basic);

            GL20.glBindAttribLocation(basic.getProgramID(), 0, "in_Position");
        }

        GL30.glBindVertexArray(vaoId);
        GL20.glEnableVertexAttribArray(0);

        GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboiId);

        GL11.glDrawElements(GL11.GL_TRIANGLES, indicesCount, GL11.GL_UNSIGNED_BYTE, 0);

        GL20.glDisableVertexAttribArray(0);
        GL30.glBindVertexArray(0);
    }

    exitOnGLError("draw terrain patch");

}

From source file:com.runescape.client.revised.client.lwjgl.Mesh.java

License:Open Source License

public void draw() {
    GL20.glEnableVertexAttribArray(0);/*w ww.  j av  a 2  s.com*/
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, this.getVbo());
    GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, Vertex.getSize() * 4, 0);
    GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, this.getSize());
    GL20.glDisableVertexAttribArray(0);
}

From source file:com.voxelplugineering.voxelsniper.render.buffer.BufferManager.java

License:Open Source License

public void destroy() {
    GL30.glBindVertexArray(vaoId);//from ww  w . j ava2  s  .  c  o m
    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(1);
    GL20.glDisableVertexAttribArray(2);

    for (BufferSection b : this.sections) {
        b.destroy();
    }

    GL30.glBindVertexArray(0);
    GL30.glDeleteVertexArrays(vaoId);
}

From source file:com.voxelplugineering.voxelsniper.render.buffer.BufferManager.java

License:Open Source License

public void renderSections() {
    GL30.glBindVertexArray(vaoId);/*w w w . ja v  a  2  s  . c o m*/
    GL20.glEnableVertexAttribArray(0);
    GL20.glEnableVertexAttribArray(1);
    GL20.glEnableVertexAttribArray(2);

    for (BufferSection b : this.sections) {
        b.draw();
    }

    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(1);
    GL20.glDisableVertexAttribArray(2);
    GL30.glBindVertexArray(0);
}

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

License:Open Source License

public void disable() {
    for (int i = 0; i < elemCount.length; i++)
        GL20.glDisableVertexAttribArray(attribId + i);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
}

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

License:Open Source License

public void disableAttribs() {
    for (int i = 0; i < getAttributeCount(); i++) {
        GL20.glDisableVertexAttribArray(i);
    }
}