游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2164|回复: 4

vertex array的用法

[复制链接]

24

主题

110

帖子

110

积分

注册会员

Rank: 2

积分
110
发表于 2005-4-22 11:55:00 | 显示全部楼层 |阅读模式
请高手 简单的解释一下 vertex array的 用法,感激不尽..

24

主题

110

帖子

110

积分

注册会员

Rank: 2

积分
110
 楼主| 发表于 2005-4-22 12:55:00 | 显示全部楼层

Re:vertex array的用法

How can I use vertex arrays to share vertices
?

Because vertex arrays let you access a set of vertices and data by index, you might believe that they're designed to optimally share vertices. Indeed, a programmer new to vertex arrays might try to render a cube, in which each vertex is shared by three faces. The futility of this becomes obvious when you add normals for lighting and each instance of the shared vertex requires a unique normal. The only way to render a cube with normals is to include multiple copies of each vertex.

Vertex arrays weren't designed to improve vertex sharing. They were intended to let the programmer to specify blocks of dynamic geometry data with as few function calls as possible.

You can share vertices with vertex arrays the same way you do with OpenGL immediate mode, by the type of primitive used. GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLE_STRIP, and GL_QUAD_STRIP share vertices between their component line segments, triangles, and quads. Other primitives do not. The type of primitive you choose to use when using vertex arrays determines whether you share vertices.

Note, however, that sharing vertices is implementation dependent. The OpenGL Specification dictates vertex array behavior, and as long as an OpenGL implementation conforms to spec, it's free to optimize vertex sharing in vertex arrays.

Some implementations feature the EXT_compiled_vertex_array extension, which is explicitly designed to let implementations share transformed vertex array data.

All contents of this page copyright of OpenGL.org - http://www.opengl.org

24

主题

110

帖子

110

积分

注册会员

Rank: 2

积分
110
 楼主| 发表于 2005-4-22 12:59:00 | 显示全部楼层

Re:vertex array的用法

上面好象说 vertex arrays 没什么用,因为光照处理的时候还是需要对每个 vertex计算法线的,
不过可以用来 做terrain ,呵呵,请高手在补充,修正一下我的观点,

5

主题

63

帖子

63

积分

注册会员

Rank: 2

积分
63
发表于 2005-4-22 15:52:00 | 显示全部楼层

Re:vertex array的用法

www.codesampler.com 有例子

24

主题

110

帖子

110

积分

注册会员

Rank: 2

积分
110
 楼主| 发表于 2005-4-22 16:36:00 | 显示全部楼层

Re:vertex array的用法

好网站,收藏了,多谢,
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-25 10:29

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表