Is glDisableClientState required?

后端 未结 2 873
臣服心动
臣服心动 2021-01-21 23:53

Every example I\'ve come across for rendering array data is similar to the following code, in which in your drawing loop you first call glEnableClientState for what you will be

2条回答
  •  猫巷女王i
    2021-01-22 00:37

    Good performance and good examples are not necessarily the same thing. Example code exists to show you how to do something, to explain clearly how things work. Good examples show you how to minimize the chance of errors in your code. And so forth.

    Performance often comes due to doing things which are "risky", but since you're doing everything right, it works out.

    It is good practice to set whatever state (within reason) you need at the time, and to unset that state once you're done. This minimizes the chance of screwing things up. But it may come at the cost of some performance.

    Then again, for simple enables/disables, it may not. Though to be quite frank, the fact that you're pulling vertices from client memory instead of a buffer object, and that you're not using glDrawRangeElements while doing so, is probably a bigger drag on performance than some extra enables/disables.

    In short: don't worry about it.

提交回复
热议问题