Jump to content
  • Advertisement
Sign in to follow this  
EternityZA

OpenGL when to call glDisableVertexAttribArray

This topic is 2852 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

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

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!