Sign in to follow this  

glVertexAttribute - where to enable?

This topic is 2849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I got a problem about glVertexAttribPointer. I created a Vertex Layout which stores the attributes (which are initialized in shader loading) and enables them. But know I just see that I'll have two Mesh Types: Mutable and Static. Difference between them is that, in the static meshes the bone data is not included. Here is how i activate VertexLayout (DRAFT):
VertexLayout::Bind(uint stride) {

	foreach(attrib in layout) {
		glVertexAttribPointer(attrib->location, attrib->size, attrib->type->glType, GL_FALSE, stride, attrib->size * attrib->type->size);
		glEnableVertexAttribArray(attrib->location);		
	}

}



And Mesh Rendering:
Mesh::Render() {

layout->Bind(sizeof(Vertex));
shader->Bind();
Draw();
shader->Unbind();
layout->Unbind();

}



My question is where to call VertexLayout::Bind function (during Rendering; during Initialization; or glVertexAttribPointer during Initialization and glEnableVertexAttribArray during Rendering)? Thanks, Kasya

Share this post


Link to post
Share on other sites

This topic is 2849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this