LWJGL Forum

Programming => OpenGL => Topic started by: madeinsoviets on February 15, 2011, 12:13:39

Title: Enabling and disabling vertex attributes
Post by: madeinsoviets on February 15, 2011, 12:13:39
Guys, do i need to disable vertex attributes after rendering? Or i just need to enable them once when created?
// Binding float attributes
for (GLSLVertexAttribute attr : attributes.values()) {
attr.bind();
}

// Rendering meshData
meshData.render();

// Unbinding attributes
for (GLSLVertexAttribute attr : attributes.values()) {
attr.unbind();
}

public void bind(){
buffer.bindBuffer();
ARBVertexShader.glVertexAttribPointerARB(location, cntPerVertex, ARBShaderObjects.GL_FLOAT, false, 0, 0);
glEnableVertexAttribArray(location);
}

public void unbind(){
glDisableVertexAttribArray(location);
}