Sign in to follow this  
EternityZA

OpenGL when to call glDisableVertexAttribArray

Recommended Posts

Hi.

Ive recently changed my shaders to use only generic vertex attributes instead of the built in ones. I got everything working fine but yesterday when i updated my graphics card drivers my game stopped working. I then ran it on my other PC that was always capable of running the game and it also crashed in the same way. I went and tested it on more PC's and it crashed on some and worked on others.

I cant get an proper error message back from opengl. I use java + lwjgl and i know that sometimes when i do something realy bad it crashes the entire JVM making it effectively impossible for me to track the exact cuase of the error. (well there might be a way in which case i just dont know about it)

Im taking a guess that it might crash on some PC's becuase i never call glDisableVertexAttribArray since i thought it wont be neccesary but i might be wrong. So my question is: When should i call it?(if ever) and when should i call glEnableVertexAttribArray again?

currently i just enable all vertex attribute arrays once when the game starts up and then i leave it enabled.

Thnx in Advance!

Share this post


Link to post
Share on other sites
The state of an attribute array should be encapsulated by the vertex array object. So unless you're using the same VAO for different objects with cases that don't require certain attributes, I don't think you need to disable arrays. You are using the new GL 3 API right?

Share this post


Link to post
Share on other sites
Quote:
Original post by rewolfer
So unless you're using the same VAO for different objects with cases that don't require certain attributes, I don't think you need to disable arrays. You are using the new GL 3 API right?


I have more than one shader. And not all of them require the same vertex attributes, does that mean i should disable the vertex attributes i dont need when switching to a diffirent shader? For example the shader i use to render 2D objects doesnt require vertex tangents like my 3D shader.

Share this post


Link to post
Share on other sites

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