Sign in to follow this  
i eat babies

glEnableClientState() Required on each render?

Recommended Posts

i eat babies    122
From the nehe tutorials i've noticed that on the vertex buffer object tutorial (which can be found at http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=45) the code calls glEnableClientState(GL_VERTEX_ARRAY) before each render and glDisableClientState(GL_VERTEX_ARRAY) after each render. Is this really necessary? My program works if you just call glEnableClientState() at initialisation and glDisableClientState() at exit. I'm tempted to just carry on this way but from experience i know thateven if it works there may be some hidden or unobvious disadvantage to doing this.

Share this post


Link to post
Share on other sites
Trenki    345
You don't have to enable disable all the time. It will stay enabled forever until you disable it. But when you let vertex arrays enabled and a later draw call does not need all of the vertex arrays they will still be referenced since you didn't disable them. This means it can result in a crash or other not wanted behaviour.

The NeHe tutorials are not very good as a learing resource and teach bad habits. A book like the OpenGL Redbook is way better for learning.

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