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:vertigo.graphics.lwjgl.LWJGL_Renderer.java

License:Open Source License

private void drawShape(Shape obj) {
    // Geometry: VBO and IBO
    if (obj.isDirty(Node.VBO)) {
        processBO(obj);/* ww  w.java  2  s  .  co m*/
        obj.setDirty(Node.VBO, false);
    }

    ShaderProg glshader = obj.getMaterial().getShaderMaterial();
    GL20.glUseProgram(glshader.getHandle());

    updateUniform();
    VBO vbo = null;

    for (Attribute attrib : attribute) {
        if (vbo.getType().equals(attrib.getType())) {
            int alocation = GL20.glGetAttribLocation(glshader.getHandle(), attrib.getName());
            GL20.glEnableVertexAttribArray(alocation);
            GL20.glVertexAttribPointer(alocation, attrib.getSize(), GL11.GL_FLOAT, false, vbo.getStride() << 2,
                    0L);
        }
    }

    if (isIndexed) {
        // draw with index
        GL11.glDrawElements(getOpenGLStyle(obj.getDrawingStyle()), /* elements */ ibo.getSize(),
                GL_UNSIGNED_INT, 0L);
        GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
        GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
        GL20.glDisableVertexAttribArray(0);
    } else {
        // draw without index
        GL11.glDrawArrays(getOpenGLStyle(obj.getDrawingStyle()), 0, capacity / vbo3f.getStride());
        GL20.glDisableVertexAttribArray(0);
        GL30.glBindVertexArray(0);
    }

    GL20.glUseProgram(0);
}

From source file:wrapper.vbo.Vbo.java

License:Open Source License

public void render() {
    if (vertid != -1) {

        shader.bind();//from  w ww .  j  ava 2 s . co  m
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texid);
        GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vertid);
        GL20.glEnableVertexAttribArray(vertexattrib);
        GL20.glEnableVertexAttribArray(textureattrib);
        GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vertid);
        GL20.glVertexAttribPointer(vertexattrib, 3, GL11.GL_FLOAT, false, 0, 0);
        GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, texcoordid);
        GL20.glVertexAttribPointer(textureattrib, 2, GL11.GL_FLOAT, false, 0, 0);
        GL20.glUniform3f(rotationuniform, rotation_x, rotation_y, rotation_z);
        GL20.glUniform3f(transformuniform, transformation.x, transformation.y, transformation.z);
        GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, vertcount);

        GL20.glDisableVertexAttribArray(vertexattrib);
        GL20.glDisableVertexAttribArray(textureattrib);

        GL11.glEnable(GL11.GL_BLEND);
        shader.unbind();
    } else {

        System.out.println("Error no bound vertid");
        return;
    }

}

From source file:wrath.client.graphics.Model.java

License:Open Source License

@Override
public void renderStop() {
    ShaderProgram.unbindShaders();/*from  ww w. j a  va 2s. co m*/
    if (texture != null)
        GL20.glDisableVertexAttribArray(TEXTURE_ATTRIB_INDEX);
    Texture.unbindTextures();
    GL20.glDisableVertexAttribArray(VERTICIES_ATTRIB_INDEX);
    GL20.glDisableVertexAttribArray(NORMALS_ATTRIB_INDEX);
    GL30.glBindVertexArray(0);
}