没有合适的资源?快使用搜索试试~ 我知道了~
首页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)
会员权益专享
最新资源
- 藏经阁-应用多活技术白皮书-40.pdf
- 藏经阁-阿里云计算巢加速器:让优秀的软件生于云、长于云-90.pdf
- 藏经阁-玩转AIGC与应用部署-92.pdf
- 藏经阁-程序员面试宝典-193.pdf
- 藏经阁-Hologres 一站式实时数仓客户案例集-223.pdf
- 藏经阁-一站式结构化数据存储Tablestore实战手册-206.pdf
- 藏经阁-阿里云产品九月刊-223.pdf
- 藏经阁-2023云原生实战案例集-179.pdf
- 藏经阁-Nacos架构&原理-326.pdf
- ZTE电联中频一张网配置指导书
- 企业级数据治理之数据安全追溯
- MISRA-C 2012-中文翻译版.pdf
- 藏经阁-《多媒体行业质量成本优化及容灾方案白皮书》-37.pdf
- 藏经阁-浅谈阿里云通用产品线Serverless的小小演化史-23.pdf
- 藏经阁-冬季实战营第一期:从零到一上手玩转云服务器-44.pdf
- 藏经阁-云上自动化运维宝典-248.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](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)