Hello Guest

Enabling and disabling vertex attributes

  • 0 Replies
  • 3012 Views
Enabling and disabling vertex attributes
« 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?
Code: [Select]
// Binding float attributes
for (GLSLVertexAttribute attr : attributes.values()) {
attr.bind();
}

// Rendering meshData
meshData.render();

// Unbinding attributes
for (GLSLVertexAttribute attr : attributes.values()) {
attr.unbind();
}
Code: [Select]
public void bind(){
buffer.bindBuffer();
ARBVertexShader.glVertexAttribPointerARB(location, cntPerVertex, ARBShaderObjects.GL_FLOAT, false, 0, 0);
glEnableVertexAttribArray(location);
}

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