Skip to main content
GameDev.net gamedev.net
🔒 Locked

glEnableClientState() Required on each render?

Started by i eat babies Mar 2, 2008 at 8:01 AM 0 replies 750+ views
Original Post
i eat babies
i eat babies
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.
Trenki
Trenki
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.