Bézier Surfaces in OpenGL
An Introduction
|
Prof. David Bernstein
James Madison University
|
|
Computer Science Department
|
bernstdh@jmu.edu
|
Review
- Control Points:
- Let \(p_{ij}\) denote control point \((i,j)\)
- The patch will be in the convex hull of the
control points
- Blending Polynomials:
- We have one array of blending polynomials for each
parameter
-
The Bézier Patch:
- \(p(u,v) = \sum_{i=0}^{n} \sum_{j=0}^{m} b_{i}(u) b_{j}(v)
p_{ij}\)
Bézier Surfaces in OpenGL
- Evaluators:
- Are used in the same way as for Bézier curves (i.e., to
compute the values for the Bernstein polynomials)
- For Uniform Meshes:
-
glMapGrid2f()
-
glEvalMesh2()
Bézier Surfaces and Textures
An Example
Bézier Surfaces in OpenGL (cont.)
Using a Uniform Mesh
openglexamples/surfaces/shade.c
(Fragment: surface)
Bézier Surfaces in OpenGL (cont.)
Initialization
openglexamples/surfaces/shade.c
(Fragment: setup)
Bézier Surfaces and Textures
An Example
Bézier Surfaces and Textures (cont.)
Initialization
openglexamples/textures/surface.c
(Fragment: init)
Bézier Surfaces and Textures (cont.)
Rendering
openglexamples/textures/surface.c
(Fragment: render)
There's Always More to Learn