没有合适的资源?快使用搜索试试~ 我知道了~
首页OpenGL Geometry Shader Tutorial(OpenGL几何着色器教程)
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/2204920/bg1.jpg)
1
GLSL Geometry Shaders
Mike Bailey
Mike
Bailey
Oregon State University
mjb – May 10, 2009
Vertices
CPU
Vertex
Processor
Transformed Vertices
The Geometry Shader:
Where Does it Fit in the Pipeline?
B
u
s
Assembled Primitive
Create New
Geometry
Assemble New
Geometry
Assemble
Geometry
mjb – May 10, 2009
Rasterizer
Fragment
Processor
Pixels
Interpolated Values
Note: a shader
program can have any
combination of vertex,
geometry, and
fragment shaders in it.
All three are not
required concurrently.
![](https://csdnimg.cn/release/download_crawler_static/2204920/bg2.jpg)
2
Geometry Shader:
What Does it Do?
Points, Lines, Line Strip, Line Loop,,Lines with
Adjacency, Line Strip with Adjacency, Triangles,
Triangle Strip, Triangle Fan, Triangles with
Adjacency, Triangle Strip with Adjacency
Application
generates
these
{
Geometry Shader
Point, Line, Line with Adjacency,
Triangle, Triangle with Adjacency
Driver feeds these
one-at-a-time
into the Geometry Shader
Adjacency,
Triangle
Strip
with
Adjacency
{
{
mjb – May 10, 2009
Points, LineStrips,
TriangleStrips
Geometry Shader
generates (almost) as
many of these as it wants
There needn’t be any correlation between Geometry Shader input type
and Geometry Shader output type. Points can generate triangles,
triangles can generate triangle strips, etc.
{
Additional Arguments are Now Available for glBegin( ):
GL_LINES_ADJACENCY_EXT
GL_LINE_STRIP_ADJACENCY_EXT
GL_TRIANGLES_ADJACENCY_EXT
GL TRIANGLE STRIP ADJECENCY EXT
mjb – May 10, 2009
GL
_
TRIANGLE
_
STRIP
_
ADJECENCY
_
EXT
![](https://csdnimg.cn/release/download_crawler_static/2204920/bg3.jpg)
3
New Adjacency Primitives (and what they do by default)
Lines with Adjacency
0123
N = 1
Line Strip with Adjacency
123450
4N vertices are given.
(where N is the number of line segments to draw).
A line segment is drawn between #1 and #2.
Vertices #0 and #3 are there to provide adjacency information.
N = 1
mjb – May 10, 2009
N+3 vertices are given
(where N is the number of line segments to draw).
A line segment is drawn between #1 and #2, #2 and #3, …, #N and #N+1.
Vertices #0 and #N+2 are there to provide adjacency information.
N = 3
Triangles with Adjacency
1
2
3
New Adjacency Primitives (and what they do by default)
5
04
2
6
5
10
9
6N vertices are given
(where N is the number of triangles to draw).
Points 0, 2, and 4 define the triangle.
Points 1, 3, and 5 tell where adjacent triangles are.
N = 1
mjb – May 10, 2009
Triangle Strip with Adjacenc
y
1
2
3
0
4
6
7
8
10
11
4+2N vertices are given
(where N is the number of triangles to draw).
Points 0, 2, 4, 6, 8, 10, …define the triangles.
Points 1, 3, 5, 7, 9, 11, … tell where adjacent triangles are.
N = 4
![](https://csdnimg.cn/release/download_crawler_static/2204920/bg4.jpg)
4
glProgramParameter Must Be Called Before the Shaders are Linked
glProgramParameteriEXT( progname, GL_GEOMETRY_VERTICES_OUT_EXT, int value )
Maximum number of
vertices this Geometry
Shader will be emitting
mjb – May 10, 2009
glProgramParameter Must Be Called Before the Shaders are Linked
glProgramParameteriEXT( progname, GL_GEOMETRY_INPUT_TYPE_EXT, int value )
The primitive type that this
Geometry Shader will be
receiving
GL_POINTS
GL LINES
Could actually come from GL_LINES,
GL_LINE_STRIP, or GL_LINE_LOOP
Could actually come from
GL_LINES_ADJACENCY_EXT or
GL_LINE_STRIP_ADJACENCY_EXT
mjb – May 10, 2009
GL
_
LINES
GL_LINES_ADJACENCY_EXT
GL_TRIANGLES
GL_TRIANGLES_ADJACENCY_EXT
Could actually come from GL_TRIANGLES,
GL_TRIANGLE_STRIP, or
GL_TRIANGLE_FAN
Could actually come from
GL_TRIANGLES_ADJACENCY_EXT or
GL_TRIANGLE_STRIP_ADJACENCY_EXT
![](https://csdnimg.cn/release/download_crawler_static/2204920/bg5.jpg)
5
glProgramParameter Must Be Called Before the Shaders are Linked
glProgramParameteriEXT( progname, GL_GEOMETRY_OUTPUT_TYPE_EXT, int value )
The primitive type that this
Geometry Shader will be sending
on to the rest of the pipeline
GL_POINTS
GL LINE STRIP
mjb – May 10, 2009
GL
_
LINE
_
STRIP
GL_TRIANGLE_STRIP
Warning: glProgramParameteriEXT( ) calls can go into a Display List,
deferring their execution until it is too late! (Bad idea…)
This gets executed
now
.
GLuint dl = glGenLists( 1 );
glNewList( dl, GL_COMPILE );
. . .
program = glCreateProgram();
. . .
g
lPro
g
ramParameteriEXT
(
p
ro
g
ram
,
GL GEOMETRY INPUT TYPE EXT
,
in
p
utGeometr
y
T
yp
e
);
gg (pg,
____
,p yyp);
glProgramParameteriEXT( program, GL_GEOMETRY_OUTPUT_TYPE_EXT, outputGeometryType );
glProgramParameteriEXT( program, GL_GEOMETRY_VERTICES_OUT_EXT, 101 );
glLinkProgram( program );
glUseProgram( program );
. . .
glEndList( );
mjb – May 10, 2009
This gets executed
now
, probably with
the wrong Program Parameter settings,
generating an unexpected Link Error!
These get executed later, whenever
the display list is glCallList’ed.
Moral: If you are creating a display list from a stream of input data, defer both the setting of
Program Parameters and the Linking of the Program until after the Display List is complete.
There is rarely a good reason to have calls to glProgramParameteriEXT( ) in a display list.
剩余23页未读,继续阅读
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/128d88dc840f4df9ae6ccf3815eae2f0_bugrunner.jpg!1)
BugRunner
- 粉丝: 792
- 资源: 8
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
会员权益专享
最新资源
- BSC关键绩效财务与客户指标详解
- 绘制企业战略地图:从财务到客户价值的六步法
- BSC关键绩效指标详解:财务与运营效率评估
- 手持移动数据终端:常见问题与WIFI设置指南
- 平衡计分卡(BSC):绩效管理与战略实施工具
- ESP8266智能家居控制系统设计与实现
- ESP8266在智能家居中的应用——网络家电控制系统
- BSC:平衡计分卡在绩效管理与信息技术中的应用
- 手持移动数据终端:常见问题与解决办法
- BSC模板:四大领域关键绩效指标详解(财务、客户、运营与成长)
- BSC:从绩效考核到计算机网络的关键概念
- BSC模板:四大维度关键绩效指标详解与预算达成分析
- 平衡计分卡(BSC):绩效考核与战略实施工具
- K-means聚类算法详解及其优缺点
- 平衡计分卡(BSC):从绩效考核到战略实施
- BSC:平衡计分卡与计算机网络中的应用
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)