when to call glDisableVertexAttribArray

Started by
1 comment, last by Wilhelm van Huyssteen 13 years, 6 months ago
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!

Advertisement
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?

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.

This topic is closed to new replies.

Advertisement