glEnableClientState和glEnableVertexAttribArray [英] glEnableClientState and glEnableVertexAttribArray

查看:94
本文介绍了glEnableClientState和glEnableVertexAttribArray的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

后者会否淘汰前者?

我正在编写要在shader 2.0硬件上工作的代码,但我想使用VAO等最新的编程约定.

I'm writing code which I would like to work on shader 2.0 hardware, but I want to use the more recent programming conventions such as VAO's.

所以我一直在使用glVertexAttribPointer函数而不是glVertexPointerglNormalPointerglColorPointer等.

So I have been using the glVertexAttribPointer functions instead of glVertexPointer, glNormalPointer, glColorPointer and so on.

似乎我们已经到了服务器-客户端概念不存在的地步……特别相关(我的意思是,它适用于切换这些缓冲区指针的状态).但是我想知道旧的En/DisableClientState实际做什么,以及它与glEnableVertexAttribArray实际做什么有什么关系.

It seems as though we have come to a point where the server-client concept isn't... particularly relevant (edit: I meant as it applies to switching state for these buffer pointers). But I'd like to know just what the old En/DisableClientState actually does and how it relates to what glEnableVertexAttribArray actually does.

我也没有5代以前的任何图形硬件,但是可以肯定的是,我的软件的某些用户可能会这样做.例如,如何防止代码无法在Radeon 9700上编译? (尽管我希望用户拥有最新的驱动程序,但它可能支持新的东西).

And I also don't have any graphics hardware from 5 generations ago, but surely some user of my software might. How might I go about preventing my code from failing to compile on a Radeon 9700 for instance? (Though I hope if a user has the latest driver it might support the new stuff)

推荐答案

似乎我们已经到了服务器-客户端概念不...特别相关的地步

It seems as though we have come to a point where the server-client concept isn't... particularly relevant

实际上这是非常相关的.整个Buffer Objects术语是针对服务器和客户端的.缓冲区是服务器端的,客户端只需发出引用服务器端缓冲区的绘图命令即可.

Actually it's very relevant. The whole Buffer Objects terminology is in terms of server and client. The buffers are server side, and the client just issues drawing commands referring to the server side buffers.

将glEnableClientState替换为glEnableVertexAttribArray的主要原因是,由于OpenGL-3始终使用顶点数组(不再有立即模式),而数据是客户端还是服务器端则由的绑定状态来区分.各种缓冲区对象插槽.如果绑定了缓冲区对象0,则数据为客户端,如果绑定的缓冲区对象为非零,则为服务器端.

The main reason for replacing glEnableClientState with glEnableVertexAttribArray is, that since OpenGL-3 always uses vertex arrays (there's no longer an immediate mode), and the distinction if the data is client or server side, is made by the binding states of the various buffer object slots. If buffer object 0 is bound, the data is client side, if the bound buffer object is nonzero it's server side.

这篇关于glEnableClientState和glEnableVertexAttribArray的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆